Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Error unknown typ name 'DS18B20'
Forum Updated to NodeBB v4.3 + New Features

Error unknown typ name 'DS18B20'

Scheduled Pinned Locked Moved Solved Mobile and Embedded
93 Posts 4 Posters 31.7k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mrjjM mrjj

    @AlexKrammer
    and that's the part that really bugs me as if those classes work alone in MainWindow, i cannot see a reason they should not work in that other class just the same ??

    void CheckTemperature::CheckTemp()
    could just have well been

    void MainWindow::CheckTemp()

    and the difference is really small.

    A Offline
    A Offline
    AlexKrammer
    wrote on last edited by
    #56

    @mrjj no in MainWindow is no CheckTemp() methode.

    mrjjM 1 Reply Last reply
    0
    • A AlexKrammer

      @mrjj no in MainWindow is no CheckTemp() methode.

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #57

      @AlexKrammer
      Yes that is ganz klar.
      Im just saying its odd that inside CheckTemperature the
      same classes dont work but outside in mainwindow it seems fine.
      I cant guess on why. Seems odd.

      A 1 Reply Last reply
      0
      • mrjjM mrjj

        @AlexKrammer
        Yes that is ganz klar.
        Im just saying its odd that inside CheckTemperature the
        same classes dont work but outside in mainwindow it seems fine.
        I cant guess on why. Seems odd.

        A Offline
        A Offline
        AlexKrammer
        wrote on last edited by
        #58

        @mrjj
        Is there a possibility to share a code with you?
        I just created a simple code to show my problem.

        mrjjM 1 Reply Last reply
        0
        • A AlexKrammer

          @mrjj
          Is there a possibility to share a code with you?
          I just created a simple code to show my problem.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #59

          @AlexKrammer
          Yes even i cant really run it i can look it over and see if i get a hint.
          use https://wetransfer.com/
          click the (...) button and switch to link type
          then drag zipped project to there
          and paste link here.

          A 1 Reply Last reply
          0
          • mrjjM mrjj

            @AlexKrammer
            Yes even i cant really run it i can look it over and see if i get a hint.
            use https://wetransfer.com/
            click the (...) button and switch to link type
            then drag zipped project to there
            and paste link here.

            A Offline
            A Offline
            AlexKrammer
            wrote on last edited by
            #60

            @mrjj link text

            Now i created the project on Windows.
            You should be able to run it.

            The two commented debug lines in checktemperature.cpp and mainwindow.cpp show the misstake.
            if you are uncomment one in checktemperature.cpp its still stay at 0.
            Also if you uncomment this: //qDebug() << C.TempEin; //must be the value of the horizontal slider in mainwindow.cpp. its still stay at 0.

            Try to run that example

            mrjjM 1 Reply Last reply
            1
            • A AlexKrammer

              @mrjj link text

              Now i created the project on Windows.
              You should be able to run it.

              The two commented debug lines in checktemperature.cpp and mainwindow.cpp show the misstake.
              if you are uncomment one in checktemperature.cpp its still stay at 0.
              Also if you uncomment this: //qDebug() << C.TempEin; //must be the value of the horizontal slider in mainwindow.cpp. its still stay at 0.

              Try to run that example

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by mrjj
              #61

              @AlexKrammer
              Super. I will later tonight. I have to drive now :)
              had a fast look.
              You are not setting anything to C. only reading from it.
              Nothing changes the S and R inside C.
              Only the ones you have free in main.
              So that is why it stays at zero.

              A 1 Reply Last reply
              0
              • mrjjM mrjj

                @AlexKrammer
                Super. I will later tonight. I have to drive now :)
                had a fast look.
                You are not setting anything to C. only reading from it.
                Nothing changes the S and R inside C.
                Only the ones you have free in main.
                So that is why it stays at zero.

                A Offline
                A Offline
                AlexKrammer
                wrote on last edited by
                #62

                @mrjj
                For sure. I'm trying to use this class to compare something.
                So yeah nothing changes S and R inside C but S.getHystTemperature(); will be changed if the Slider moved. and R.actualTemp1 will be changed, if cnt hit 3 in MainWindow::LOOP
                or rather in real if the sensor will be evaluated.
                So if i call the methode C.CheckTemp(); S.getHystTemperature() and R.actualTemp1 do have values who could be compare.
                if i code:

                TempEin = S.getHystTemperature();
                Test = R.actualTemp1;
                

                i'm going to set the Variable TempEin equal to S.getHystTemperature() (Which is changed when the slider moved)
                and i'm going to set Test equal to R.actualTemp1 (Which every times change when cnt hits 3 in MainWindow)
                Or isnt that the correct way to compare something or rather put values from a other class into a class?

                mrjjM 1 Reply Last reply
                0
                • A AlexKrammer

                  @mrjj
                  For sure. I'm trying to use this class to compare something.
                  So yeah nothing changes S and R inside C but S.getHystTemperature(); will be changed if the Slider moved. and R.actualTemp1 will be changed, if cnt hit 3 in MainWindow::LOOP
                  or rather in real if the sensor will be evaluated.
                  So if i call the methode C.CheckTemp(); S.getHystTemperature() and R.actualTemp1 do have values who could be compare.
                  if i code:

                  TempEin = S.getHystTemperature();
                  Test = R.actualTemp1;
                  

                  i'm going to set the Variable TempEin equal to S.getHystTemperature() (Which is changed when the slider moved)
                  and i'm going to set Test equal to R.actualTemp1 (Which every times change when cnt hits 3 in MainWindow)
                  Or isnt that the correct way to compare something or rather put values from a other class into a class?

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #63

                  Hi
                  Just so we agree. Nothing you do in mainwindow with S/R
                  will have any effect on the S and R in C.

                  • C.CheckTemp(); S.getHystTemperature() and R.actualTemp1 do have values who could be compare.

                  Yes if in real code something actually changes them.
                  In the Demo, they will always stay zero as the slider changes S/R in main and
                  those new values are not out into C.
                  so in demo code
                  C.TempEin will never change.

                  Else i see nothing wrong but I not sure why you have both
                  SetTemperature S;
                  ReadTemperature R;
                  in maniwindow

                  and then also in C. could those in C not be enough ?

                  A 1 Reply Last reply
                  0
                  • mrjjM mrjj

                    Hi
                    Just so we agree. Nothing you do in mainwindow with S/R
                    will have any effect on the S and R in C.

                    • C.CheckTemp(); S.getHystTemperature() and R.actualTemp1 do have values who could be compare.

                    Yes if in real code something actually changes them.
                    In the Demo, they will always stay zero as the slider changes S/R in main and
                    those new values are not out into C.
                    so in demo code
                    C.TempEin will never change.

                    Else i see nothing wrong but I not sure why you have both
                    SetTemperature S;
                    ReadTemperature R;
                    in maniwindow

                    and then also in C. could those in C not be enough ?

                    A Offline
                    A Offline
                    AlexKrammer
                    wrote on last edited by AlexKrammer
                    #64

                    @mrjj
                    No that is not true.
                    In mainwindow i change the slider. So i change HystTemperature.
                    That will change S.getHystTemperature(); too. Doesnt it?

                    Also every 2.5 second when the cnt hit 3 in mainwindow. The actualTemp1 will be incremented with 1. So R.actualTemp will be greater then before. Doesnt it?
                    So why are in Class C the Variable not changing?

                    In order to to change the varibale like in my fault. I must have this in MainWindow. When i move the slider im going to change the variable HystTemperature.
                    Here in the demo its the same like in real. Every 2.5 second the sensor will be evaluated. So here in the demo only incremented with 1.

                    Im changing the Variable R.actualTemp1 and S.getHystTemperature in MainWindow.
                    In order to compare both varibales i created a new class.
                    So why arent in Class CheckTemperature the variables changed?

                    mrjjM 1 Reply Last reply
                    0
                    • A AlexKrammer

                      @mrjj
                      No that is not true.
                      In mainwindow i change the slider. So i change HystTemperature.
                      That will change S.getHystTemperature(); too. Doesnt it?

                      Also every 2.5 second when the cnt hit 3 in mainwindow. The actualTemp1 will be incremented with 1. So R.actualTemp will be greater then before. Doesnt it?
                      So why are in Class C the Variable not changing?

                      In order to to change the varibale like in my fault. I must have this in MainWindow. When i move the slider im going to change the variable HystTemperature.
                      Here in the demo its the same like in real. Every 2.5 second the sensor will be evaluated. So here in the demo only incremented with 1.

                      Im changing the Variable R.actualTemp1 and S.getHystTemperature in MainWindow.
                      In order to compare both varibales i created a new class.
                      So why arent in Class CheckTemperature the variables changed?

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by mrjj
                      #65

                      @AlexKrammer

                      • That will change S.getHystTemperature(); too. Doesnt it?
                        Hi
                        Not at all. the S/R in mainwindow are on its own and will not affect those in C.

                      • So why arent in Class CheckTemperature the variables changed?

                      As nothing changes them.

                      Maybe this is why i get confused about what is not working.

                      The slider changes the values of S/R in MainWin. Not in C.s / C.r so
                      did you expect the values in C to also change ?

                      A 1 Reply Last reply
                      2
                      • mrjjM mrjj

                        @AlexKrammer

                        • That will change S.getHystTemperature(); too. Doesnt it?
                          Hi
                          Not at all. the S/R in mainwindow are on its own and will not affect those in C.

                        • So why arent in Class CheckTemperature the variables changed?

                        As nothing changes them.

                        Maybe this is why i get confused about what is not working.

                        The slider changes the values of S/R in MainWin. Not in C.s / C.r so
                        did you expect the values in C to also change ?

                        A Offline
                        A Offline
                        AlexKrammer
                        wrote on last edited by
                        #66

                        @mrjj
                        well if i change the variable of e.g. Class" SetTemperature" float "HystTemperature"
                        And if i call the methode S.getHystTemperature(); i try to get the variable HystTemperature.

                        Or is that the wrong way to put the Varible which is changed by the slider into the Class "CheckTemperature"

                        then my next question would be how can I do that? :)
                        Putting the changed variable "HystTemperature" from class "SetTemperature" and the changed variable "actualTemp1" from class "ReadTemperature" into the class "CheckTemperature".

                        mrjjM 1 Reply Last reply
                        0
                        • A AlexKrammer

                          @mrjj
                          well if i change the variable of e.g. Class" SetTemperature" float "HystTemperature"
                          And if i call the methode S.getHystTemperature(); i try to get the variable HystTemperature.

                          Or is that the wrong way to put the Varible which is changed by the slider into the Class "CheckTemperature"

                          then my next question would be how can I do that? :)
                          Putting the changed variable "HystTemperature" from class "SetTemperature" and the changed variable "actualTemp1" from class "ReadTemperature" into the class "CheckTemperature".

                          mrjjM Offline
                          mrjjM Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on last edited by
                          #67

                          @AlexKrammer
                          hi
                          to change the one inside C with slider it has to be

                          void MainWindow::on_horizontalSlider_valueChanged(int x)
                          {
                              float y;
                            ///  S.setHystTemperature(x);
                           C.S.setHystTemperature(x);
                          
                          ///    y = S.getHystTemperature();
                           C.S.getHystTemperature(x);
                              QString Temp = QString::number(y);
                              ui->label->setText(Temp + "°C");
                          }
                          
                          
                          • Putting the changed variable "HystTemperature" from class "SetTemperature" and the changed variable "actualTemp1" from class "ReadTemperature" into the class "CheckTemperature".

                          auto value1 = S.getHystTemperature();
                          auto value2 = R.actualTemp1;

                          C.setHystTemperature(value1);
                          C.R.actualTemp1 = value2;

                          something like that.

                          Its very confusing you named the classes as function names :)
                          SetTemperature rally looks like a function but its a class.

                          A 1 Reply Last reply
                          2
                          • mrjjM mrjj

                            @AlexKrammer
                            hi
                            to change the one inside C with slider it has to be

                            void MainWindow::on_horizontalSlider_valueChanged(int x)
                            {
                                float y;
                              ///  S.setHystTemperature(x);
                             C.S.setHystTemperature(x);
                            
                            ///    y = S.getHystTemperature();
                             C.S.getHystTemperature(x);
                                QString Temp = QString::number(y);
                                ui->label->setText(Temp + "°C");
                            }
                            
                            
                            • Putting the changed variable "HystTemperature" from class "SetTemperature" and the changed variable "actualTemp1" from class "ReadTemperature" into the class "CheckTemperature".

                            auto value1 = S.getHystTemperature();
                            auto value2 = R.actualTemp1;

                            C.setHystTemperature(value1);
                            C.R.actualTemp1 = value2;

                            something like that.

                            Its very confusing you named the classes as function names :)
                            SetTemperature rally looks like a function but its a class.

                            A Offline
                            A Offline
                            AlexKrammer
                            wrote on last edited by AlexKrammer
                            #68

                            @mrjj

                             auto value1 = S.getHystTemperature();
                             auto value2 = R.actualTemp1;
                             C.setHystTemperature(value1);
                             C.R.actualTemp1 = value2;
                            

                            i dont understand this step... cause i dont have a C.setHystTemperature thats a methode at SetTemperature

                            void MainWindow::on_horizontalSlider_valueChanged(int x)
                            {
                                float y;
                              ///  S.setHystTemperature(x);
                             C.S.setHystTemperature(x);
                            
                            ///    y = S.getHystTemperature();
                             C.S.getHystTemperature(x);
                                QString Temp = QString::number(y);
                                ui->label->setText(Temp + "°C");
                            }
                            

                            if you write: C.S.setHystTemperature(x); do you set HystTemperature in Set Temperature and also in CheckTemperature? Do I understand right?

                            mrjjM 1 Reply Last reply
                            0
                            • A AlexKrammer

                              @mrjj

                               auto value1 = S.getHystTemperature();
                               auto value2 = R.actualTemp1;
                               C.setHystTemperature(value1);
                               C.R.actualTemp1 = value2;
                              

                              i dont understand this step... cause i dont have a C.setHystTemperature thats a methode at SetTemperature

                              void MainWindow::on_horizontalSlider_valueChanged(int x)
                              {
                                  float y;
                                ///  S.setHystTemperature(x);
                               C.S.setHystTemperature(x);
                              
                              ///    y = S.getHystTemperature();
                               C.S.getHystTemperature(x);
                                  QString Temp = QString::number(y);
                                  ui->label->setText(Temp + "°C");
                              }
                              

                              if you write: C.S.setHystTemperature(x); do you set HystTemperature in Set Temperature and also in CheckTemperature? Do I understand right?

                              mrjjM Offline
                              mrjjM Offline
                              mrjj
                              Lifetime Qt Champion
                              wrote on last edited by
                              #69

                              @AlexKrammer

                              -i dont understand this step... cause i dont have a C.setHystTemperature thats a methode at SetTemperature

                              ok but the idea is the same. just use the correct method/variable then.
                              C.setXXX (value1); or
                              C.S.xxx = value

                              if you write: C.S.setHystTemperature(x); do you set HystTemperature in Set Temperature and also in CheckTemperature? Do I understand right?
                              yes you ONLY set in C.S. not the ones in mainWindow.
                              So slider ONLY changes the one in C.

                              A 1 Reply Last reply
                              0
                              • mrjjM mrjj

                                @AlexKrammer

                                -i dont understand this step... cause i dont have a C.setHystTemperature thats a methode at SetTemperature

                                ok but the idea is the same. just use the correct method/variable then.
                                C.setXXX (value1); or
                                C.S.xxx = value

                                if you write: C.S.setHystTemperature(x); do you set HystTemperature in Set Temperature and also in CheckTemperature? Do I understand right?
                                yes you ONLY set in C.S. not the ones in mainWindow.
                                So slider ONLY changes the one in C.

                                A Offline
                                A Offline
                                AlexKrammer
                                wrote on last edited by AlexKrammer
                                #70

                                @mrjj
                                do you mean

                                void MainWindow::on_horizontalSlider_valueChanged(int x)
                                {
                                    float y;
                                  ///  S.setHystTemperature(x);
                                C.S.setHystTemperature(x);
                                
                                ///    y = S.getHystTemperature();
                                    y = C.S.getHystTemperature();
                                    QString Temp = QString::number(y);
                                    ui->label->setText(Temp + "°C");
                                }
                                
                                LOOP
                                {
                                    C.R.readTemperature(1);
                                }
                                

                                and why should i only set it in CheckTemperature and not the Classvarible? Shouldn't i do i both?

                                mrjjM 1 Reply Last reply
                                0
                                • A AlexKrammer

                                  @mrjj
                                  do you mean

                                  void MainWindow::on_horizontalSlider_valueChanged(int x)
                                  {
                                      float y;
                                    ///  S.setHystTemperature(x);
                                  C.S.setHystTemperature(x);
                                  
                                  ///    y = S.getHystTemperature();
                                      y = C.S.getHystTemperature();
                                      QString Temp = QString::number(y);
                                      ui->label->setText(Temp + "°C");
                                  }
                                  
                                  LOOP
                                  {
                                      C.R.readTemperature(1);
                                  }
                                  

                                  and why should i only set it in CheckTemperature and not the Classvarible? Shouldn't i do i both?

                                  mrjjM Offline
                                  mrjjM Offline
                                  mrjj
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #71

                                  @AlexKrammer

                                  Yes if you want BOTH to change you should set both.
                                  both in C.xxx and directly with S/R in mainwindow :)

                                  A 1 Reply Last reply
                                  1
                                  • mrjjM mrjj

                                    @AlexKrammer

                                    Yes if you want BOTH to change you should set both.
                                    both in C.xxx and directly with S/R in mainwindow :)

                                    A Offline
                                    A Offline
                                    AlexKrammer
                                    wrote on last edited by AlexKrammer
                                    #72

                                    @mrjj
                                    i dont understand haha.
                                    how and where should i set both?

                                    And what do you mean with C.xxx the only thing that i have in the class CheckTemperature is the methode CheckTemp

                                    mrjjM 1 Reply Last reply
                                    0
                                    • A AlexKrammer

                                      @mrjj
                                      i dont understand haha.
                                      how and where should i set both?

                                      And what do you mean with C.xxx the only thing that i have in the class CheckTemperature is the methode CheckTemp

                                      mrjjM Offline
                                      mrjjM Offline
                                      mrjj
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #73

                                      @AlexKrammer
                                      Ok i not sure i understand what you really want either. :)
                                      Its feels like you expect something magical to happen to the C.s/R.r

                                      • And what do you mean with C.xxx the only thing that i have in the class CheckTemperature is the methode CheckTemp

                                      i mean what ever you want to set in the class.
                                      maybe its C.s instead.

                                      A 1 Reply Last reply
                                      0
                                      • mrjjM mrjj

                                        @AlexKrammer
                                        Ok i not sure i understand what you really want either. :)
                                        Its feels like you expect something magical to happen to the C.s/R.r

                                        • And what do you mean with C.xxx the only thing that i have in the class CheckTemperature is the methode CheckTemp

                                        i mean what ever you want to set in the class.
                                        maybe its C.s instead.

                                        A Offline
                                        A Offline
                                        AlexKrammer
                                        wrote on last edited by
                                        #74

                                        @mrjj
                                        hahaha :D

                                        nobody knows anything yet :D

                                        Summery:
                                        First i got one Class called SetTemperature.
                                        In that class is a variable HystTemperature.
                                        In order to change the value of that variable you need to create a object of Set Temperature like:

                                        SetTemperature S;
                                        S.setHystTemperature(e.g. 5);
                                        

                                        to receive that variable you also use:

                                        float x;
                                        Set Temperature S;
                                        x = S.getHystTemperature();
                                        

                                        The second class called "ReadTemperature" got one methode to evaluate the temperature and save it in the class variable actualTemp1. First you have to create an object of the class like:

                                        ReadTemperature R;
                                        R.ReadTemp(1);
                                        //Then actualTemp1 will be changed e.g. incremented by 1
                                        

                                        Then the third class should compare that both variables. So i have to create 2 object of each class and call the variables like:

                                        float x;
                                        float y;
                                        
                                        SetTemperature S;
                                        ReadTemperature R;
                                        
                                        x = S.getHystTemperature();
                                        y = R.actualTemp1;
                                        

                                        thats the only thing i want.
                                        But what do you mean e.g. with C.S.getHystTemperature() and so on?
                                        Where do you take de C.S.getHystTemperature()? and what should it do?

                                        Also with

                                        auto value2 = R.actualTemp1;
                                        C.R.actualTemp1 = value2;
                                        

                                        Where comes and what is C.R.actualTemp1^^

                                        mrjjM 1 Reply Last reply
                                        0
                                        • A AlexKrammer

                                          @mrjj
                                          hahaha :D

                                          nobody knows anything yet :D

                                          Summery:
                                          First i got one Class called SetTemperature.
                                          In that class is a variable HystTemperature.
                                          In order to change the value of that variable you need to create a object of Set Temperature like:

                                          SetTemperature S;
                                          S.setHystTemperature(e.g. 5);
                                          

                                          to receive that variable you also use:

                                          float x;
                                          Set Temperature S;
                                          x = S.getHystTemperature();
                                          

                                          The second class called "ReadTemperature" got one methode to evaluate the temperature and save it in the class variable actualTemp1. First you have to create an object of the class like:

                                          ReadTemperature R;
                                          R.ReadTemp(1);
                                          //Then actualTemp1 will be changed e.g. incremented by 1
                                          

                                          Then the third class should compare that both variables. So i have to create 2 object of each class and call the variables like:

                                          float x;
                                          float y;
                                          
                                          SetTemperature S;
                                          ReadTemperature R;
                                          
                                          x = S.getHystTemperature();
                                          y = R.actualTemp1;
                                          

                                          thats the only thing i want.
                                          But what do you mean e.g. with C.S.getHystTemperature() and so on?
                                          Where do you take de C.S.getHystTemperature()? and what should it do?

                                          Also with

                                          auto value2 = R.actualTemp1;
                                          C.R.actualTemp1 = value2;
                                          

                                          Where comes and what is C.R.actualTemp1^^

                                          mrjjM Offline
                                          mrjjM Offline
                                          mrjj
                                          Lifetime Qt Champion
                                          wrote on last edited by mrjj
                                          #75

                                          @AlexKrammer
                                          hehe lots of talk for 2 floats :)
                                          Ok first part i fully understand. seems fine.
                                          but not sure what you need the C class for then ?

                                          I dont understand when you will update ITs C/S and such.
                                          Maybe just drop C completely and do what you want to do with C/S in mainWin ?

                                          A 1 Reply Last reply
                                          0

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved