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 49.5k 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.
  • 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
                    • mrjjM mrjj

                      @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 Offline
                      A Offline
                      AlexKrammer
                      wrote on last edited by
                      #76

                      @mrjj
                      yes it should be possible.
                      But to keep the structur and let it look quiet professional i'd tried to put it into a class.
                      But the one thing that i dont understand yet is. If i create a object each class in CheckTemp and try to call the variables out of them. why they dont include the values which i gave them e.g when the slider moved.

                      mrjjM 1 Reply Last reply
                      0
                      • A AlexKrammer

                        @mrjj
                        yes it should be possible.
                        But to keep the structur and let it look quiet professional i'd tried to put it into a class.
                        But the one thing that i dont understand yet is. If i create a object each class in CheckTemp and try to call the variables out of them. why they dont include the values which i gave them e.g when the slider moved.

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

                        @AlexKrammer said in Error unknown typ name 'DS18B20':

                        But the one thing that i dont understand yet is. If i create a object each class in CheckTemp and try to call the variables out of them. why they dont include the values which i gave them e.g when the slider moved.

                        Because they are NOT tied to the S/R in main. its own variables and unless you
                        directly write to them via C.s then they stay at zero.

                        So when you change C/S that lives in main, the ones in C does not change with them
                        They are seperate variables and has own values and will only change if you directly do that.

                        much like

                        int NUM =4;

                        class Test {
                        int NUM=0;
                        }

                        TEST c;

                        NUM = 100;

                        will have not change c.NUM at all.

                        A 2 Replies Last reply
                        2
                        • mrjjM mrjj

                          @AlexKrammer said in Error unknown typ name 'DS18B20':

                          But the one thing that i dont understand yet is. If i create a object each class in CheckTemp and try to call the variables out of them. why they dont include the values which i gave them e.g when the slider moved.

                          Because they are NOT tied to the S/R in main. its own variables and unless you
                          directly write to them via C.s then they stay at zero.

                          So when you change C/S that lives in main, the ones in C does not change with them
                          They are seperate variables and has own values and will only change if you directly do that.

                          much like

                          int NUM =4;

                          class Test {
                          int NUM=0;
                          }

                          TEST c;

                          NUM = 100;

                          will have not change c.NUM at all.

                          A Offline
                          A Offline
                          AlexKrammer
                          wrote on last edited by
                          #78
                          This post is deleted!
                          1 Reply Last reply
                          0
                          • mrjjM mrjj

                            @AlexKrammer said in Error unknown typ name 'DS18B20':

                            But the one thing that i dont understand yet is. If i create a object each class in CheckTemp and try to call the variables out of them. why they dont include the values which i gave them e.g when the slider moved.

                            Because they are NOT tied to the S/R in main. its own variables and unless you
                            directly write to them via C.s then they stay at zero.

                            So when you change C/S that lives in main, the ones in C does not change with them
                            They are seperate variables and has own values and will only change if you directly do that.

                            much like

                            int NUM =4;

                            class Test {
                            int NUM=0;
                            }

                            TEST c;

                            NUM = 100;

                            will have not change c.NUM at all.

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

                            @mrjj
                            yeah but i dont write NUM = 100.
                            I write c.NUM = 100.

                            i write:

                            class TEST{
                                int NUM = 0;
                            }
                            
                            MainWindow{
                            TEST c;
                            c.NUM = 100;
                            }
                            
                            CheckTemperature
                            {
                                 float example;
                                 TEST c;
                                 example  = c.NUM;
                                 //example still 0
                            }
                            
                            
                            
                            mrjjM 1 Reply Last reply
                            0
                            • A AlexKrammer

                              @mrjj
                              yeah but i dont write NUM = 100.
                              I write c.NUM = 100.

                              i write:

                              class TEST{
                                  int NUM = 0;
                              }
                              
                              MainWindow{
                              TEST c;
                              c.NUM = 100;
                              }
                              
                              CheckTemperature
                              {
                                   float example;
                                   TEST c;
                                   example  = c.NUM;
                                   //example still 0
                              }
                              
                              
                              
                              mrjjM Offline
                              mrjjM Offline
                              mrjj
                              Lifetime Qt Champion
                              wrote on last edited by
                              #80

                              @AlexKrammer
                              Yes and then its ok. then you update c.num but NOT
                              the NUM outside.
                              Its 100% the same with your SetTemperature/ReadTemperature
                              in MainWin and those in C.

                              A 1 Reply Last reply
                              0
                              • mrjjM mrjj

                                @AlexKrammer
                                Yes and then its ok. then you update c.num but NOT
                                the NUM outside.
                                Its 100% the same with your SetTemperature/ReadTemperature
                                in MainWin and those in C.

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

                                @mrjj
                                i dont want to update NUM outside..
                                look one post above. I edited it

                                mrjjM 1 Reply Last reply
                                0
                                • A AlexKrammer

                                  @mrjj
                                  i dont want to update NUM outside..
                                  look one post above. I edited it

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

                                  @AlexKrammer

                                  CheckTemperature
                                  {
                                       float example;
                                       TEST c;
                                       example  = c.NUM;
                                       //example still 0
                                  }
                                  

                                  Yes as you make a local TEST c variable
                                  so if you did if you did c.NUM=100
                                  somewhere else its not the same TEST instance.

                                  So TEST c; should be a member if you want to set its NUM outside of CheckTemperature

                                  then it works.

                                  A 1 Reply Last reply
                                  2
                                  • mrjjM mrjj

                                    @AlexKrammer

                                    CheckTemperature
                                    {
                                         float example;
                                         TEST c;
                                         example  = c.NUM;
                                         //example still 0
                                    }
                                    

                                    Yes as you make a local TEST c variable
                                    so if you did if you did c.NUM=100
                                    somewhere else its not the same TEST instance.

                                    So TEST c; should be a member if you want to set its NUM outside of CheckTemperature

                                    then it works.

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

                                    @mrjj
                                    yes i did it?
                                    i created a object of Test in MainWindow
                                    then i put c.NUM = 100;

                                    after that i created a object of Test in CheckTemperature too
                                    but c.NUM dont have 100. Its still have 0.

                                    jsulmJ 1 Reply Last reply
                                    0
                                    • A AlexKrammer

                                      @mrjj
                                      yes i did it?
                                      i created a object of Test in MainWindow
                                      then i put c.NUM = 100;

                                      after that i created a object of Test in CheckTemperature too
                                      but c.NUM dont have 100. Its still have 0.

                                      jsulmJ Offline
                                      jsulmJ Offline
                                      jsulm
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #84

                                      @AlexKrammer So, you create two instances of Test, change one of them and expect the other one to have the same change? How? By magic? Maybe I don't get something as the thread is already quite long...

                                      Test a;
                                      Test b;
                                      a.NUM = 100;
                                      // Why should b.NUM be 100 now?!
                                      

                                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                                      A 1 Reply Last reply
                                      1
                                      • jsulmJ jsulm

                                        @AlexKrammer So, you create two instances of Test, change one of them and expect the other one to have the same change? How? By magic? Maybe I don't get something as the thread is already quite long...

                                        Test a;
                                        Test b;
                                        a.NUM = 100;
                                        // Why should b.NUM be 100 now?!
                                        
                                        A Offline
                                        A Offline
                                        AlexKrammer
                                        wrote on last edited by AlexKrammer
                                        #85

                                        @jsulm
                                        where do i create two instaces of Test? I only create a Object of TEST with c. change the Variable NUM and try to get c.NUM in a other Class

                                        class TEST{
                                        int NUM = 0;
                                        }

                                        MainWindow{
                                        TEST c;
                                        c.NUM = 100;
                                        }

                                        CheckTemperature
                                        {
                                        float example;
                                        TEST c;
                                        example = c.NUM;
                                        //example still 0
                                        }

                                        Or do i change the value of the variable in the object TEST c (c.NUM) i created? Not the Variable in the class TEST

                                        jsulmJ 1 Reply Last reply
                                        0
                                        • A AlexKrammer

                                          @jsulm
                                          where do i create two instaces of Test? I only create a Object of TEST with c. change the Variable NUM and try to get c.NUM in a other Class

                                          class TEST{
                                          int NUM = 0;
                                          }

                                          MainWindow{
                                          TEST c;
                                          c.NUM = 100;
                                          }

                                          CheckTemperature
                                          {
                                          float example;
                                          TEST c;
                                          example = c.NUM;
                                          //example still 0
                                          }

                                          Or do i change the value of the variable in the object TEST c (c.NUM) i created? Not the Variable in the class TEST

                                          jsulmJ Offline
                                          jsulmJ Offline
                                          jsulm
                                          Lifetime Qt Champion
                                          wrote on last edited by jsulm
                                          #86

                                          @AlexKrammer said in Error unknown typ name 'DS18B20':

                                          where do i create two instaces of Test?

                                          In the code you just posted (hint: instance is the same thing as object):

                                          MainWindow{
                                          TEST c; // First instance
                                          c.NUM = 100;
                                          }
                                          
                                          CheckTemperature
                                          {
                                          float example;
                                          TEST c; // Second instance, c here is NOT the same as in MainWindow!
                                          example = c.NUM;
                                          //example still 0
                                          }
                                          

                                          https://forum.qt.io/topic/113070/qt-code-of-conduct

                                          mrjjM 1 Reply Last reply
                                          2

                                          • Login

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