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 29.8k 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
    that to files OneWire.h and OneWire.cpp include also like DS18B20 as existing File?

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

    @AlexKrammer
    Yes but im not sure it will just work with a pi board.

    A 2 Replies Last reply
    0
    • mrjjM mrjj

      @AlexKrammer
      Yes but im not sure it will just work with a pi board.

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

      @mrjj
      its even dont work on my windows pc ^^

      1 Reply Last reply
      0
      • mrjjM mrjj

        @AlexKrammer
        Yes but im not sure it will just work with a pi board.

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

        @mrjj
        There are still error. i dont know, why you dont receive that errors respectively when you try to compile the code, why its work. if i try to run it, there are hundreds of error messages.
        Unbenannt.JPG

        mrjjM 1 Reply Last reply
        0
        • A AlexKrammer

          @mrjj
          There are still error. i dont know, why you dont receive that errors respectively when you try to compile the code, why its work. if i try to run it, there are hundreds of error messages.
          Unbenannt.JPG

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

          @AlexKrammer
          Well i didnt download and added OneWire to see. Maybe why.
          Just checkout DS18B20 as question started with.
          I dont have a board to test on so i would never be able to run it anyway.

          Thats just #include <stdio.h> it complains about.
          Very odd the .h does not include that.

          Also, you do understand that these libs are meant to be used ON the board.?
          They can never read a sensor on a pi board where apps run on win pc and have the pi board connected via USB
          or similar.
          But you do seem to have a raspberry Debian running so you are compiling directly on the board, right ?

          A 1 Reply Last reply
          0
          • mrjjM mrjj

            @AlexKrammer
            Well i didnt download and added OneWire to see. Maybe why.
            Just checkout DS18B20 as question started with.
            I dont have a board to test on so i would never be able to run it anyway.

            Thats just #include <stdio.h> it complains about.
            Very odd the .h does not include that.

            Also, you do understand that these libs are meant to be used ON the board.?
            They can never read a sensor on a pi board where apps run on win pc and have the pi board connected via USB
            or similar.
            But you do seem to have a raspberry Debian running so you are compiling directly on the board, right ?

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

            @mrjj
            Now I includes #include <stdio.h> in ds18b20.cpp but nothing changed.
            the error C1083 does not depend on stdio.h, does it?

            yes i have both systems running.

            mrjjM 1 Reply Last reply
            0
            • A AlexKrammer

              @mrjj
              Now I includes #include <stdio.h> in ds18b20.cpp but nothing changed.
              the error C1083 does not depend on stdio.h, does it?

              yes i have both systems running.

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

              @AlexKrammer
              Ok. Good. Just checking
              No that error comes from some missing .h file. As it shows.
              From the utils folder
              https://github.com/PaulStoffregen/OneWire/tree/master/util
              so you should add those too it seems.

              1 Reply Last reply
              0
              • A Offline
                A Offline
                AlexKrammer
                wrote on last edited by
                #31

                oh thanks. that i missed. but its funny. i have the same errors on windows and raspien.
                i think it dont depend where to compily. The only different i think will be, on raspberry will the outputs work. Dont you think?

                mrjjM 1 Reply Last reply
                0
                • A AlexKrammer

                  oh thanks. that i missed. but its funny. i have the same errors on windows and raspien.
                  i think it dont depend where to compily. The only different i think will be, on raspberry will the outputs work. Dont you think?

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

                  @AlexKrammer
                  Well it should give same errors from compile on both systems if they are related to missing includes.
                  What are the errors now ?

                  Still bitRead etc ?

                  And yes, the biggest difference is when you run it. On win pc there would be no hardware to to talk to.

                  A 1 Reply Last reply
                  0
                  • mrjjM mrjj

                    @AlexKrammer
                    Well it should give same errors from compile on both systems if they are related to missing includes.
                    What are the errors now ?

                    Still bitRead etc ?

                    And yes, the biggest difference is when you run it. On win pc there would be no hardware to to talk to.

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

                    @mrjj no but much more ^
                    screenshot.png

                    1 Reply Last reply
                    0
                    • mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #34

                      Hi
                      Seems to come from
                      https://www.arduino.cc/reference/en/language/functions/interrupts/nointerrupts/

                      So I think we are down the wrong path using this with a pi board as it seems tied to
                      Arduino.

                      A 1 Reply Last reply
                      0
                      • mrjjM mrjj

                        Hi
                        Seems to come from
                        https://www.arduino.cc/reference/en/language/functions/interrupts/nointerrupts/

                        So I think we are down the wrong path using this with a pi board as it seems tied to
                        Arduino.

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

                        @mrjj
                        and what will be the right way. is it possible to use qt for this?
                        is it possible to create a own library to convert the input of the sensor in a temperatur?

                        mrjjM 1 Reply Last reply
                        0
                        • A AlexKrammer

                          @mrjj
                          and what will be the right way. is it possible to use qt for this?
                          is it possible to create a own library to convert the input of the sensor in a temperatur?

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

                          @AlexKrammer
                          Hi
                          But do you have such sensor ?
                          and hook it up to the board like they do here ?
                          https://www.circuitbasics.com/raspberry-pi-ds18b20-temperature-sensor-tutorial/

                          A 1 Reply Last reply
                          0
                          • mrjjM mrjj

                            @AlexKrammer
                            Hi
                            But do you have such sensor ?
                            and hook it up to the board like they do here ?
                            https://www.circuitbasics.com/raspberry-pi-ds18b20-temperature-sensor-tutorial/

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

                            @mrjj yea for sure. but i want to use qt with c++. do create this application

                            mrjjM 1 Reply Last reply
                            0
                            • A AlexKrammer

                              @mrjj yea for sure. but i want to use qt with c++. do create this application

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

                              @AlexKrammer
                              I think you need a c++ lib then like
                              https://github.com/TeraHz/DS18B20
                              to interface with the hardware.

                              A 2 Replies Last reply
                              0
                              • mrjjM mrjj

                                @AlexKrammer
                                I think you need a c++ lib then like
                                https://github.com/TeraHz/DS18B20
                                to interface with the hardware.

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

                                @mrjj to interface with the hardware ill use wiringpi. thats work good. i can turn on und off leds and i can read pins.
                                how does this lib work?

                                1 Reply Last reply
                                0
                                • mrjjM mrjj

                                  @AlexKrammer
                                  I think you need a c++ lib then like
                                  https://github.com/TeraHz/DS18B20
                                  to interface with the hardware.

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

                                  @mrjj ou i just saw. it looks like that one right?
                                  "are you using the DS18B20::DS18B20(const char* address) version"

                                  mrjjM 1 Reply Last reply
                                  0
                                  • A AlexKrammer

                                    @mrjj ou i just saw. it looks like that one right?
                                    "are you using the DS18B20::DS18B20(const char* address) version"

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

                                    @AlexKrammer
                                    Heh yes but on this is says it should work with PI
                                    and it has more includes.
                                    So maybe this will actually work once we find out what that address should be :)

                                    A 1 Reply Last reply
                                    0
                                    • mrjjM mrjj

                                      @AlexKrammer
                                      Heh yes but on this is says it should work with PI
                                      and it has more includes.
                                      So maybe this will actually work once we find out what that address should be :)

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

                                      @mrjj
                                      Now i tried to evaluate the temperatur with the c++ library.
                                      The code looks good. There is no error, but if i run the projekt. its going to do this step

                                      char w1_address [ 16 ];
                                      DS18B20 w1Device1 (w1_address);
                                      tempNow = w1Device1. getTemp ();
                                      

                                      its going to crash. So i think there is a mistake in the adress.
                                      i put in the raspberry pin.

                                      mrjjM 1 Reply Last reply
                                      0
                                      • A AlexKrammer

                                        @mrjj
                                        Now i tried to evaluate the temperatur with the c++ library.
                                        The code looks good. There is no error, but if i run the projekt. its going to do this step

                                        char w1_address [ 16 ];
                                        DS18B20 w1Device1 (w1_address);
                                        tempNow = w1Device1. getTemp ();
                                        

                                        its going to crash. So i think there is a mistake in the adress.
                                        i put in the raspberry pin.

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

                                        @AlexKrammer
                                        im not sure a pin is right there.
                                        Try read some the many tuts and see what they use for adress.

                                        A 1 Reply Last reply
                                        0
                                        • mrjjM mrjj

                                          @AlexKrammer
                                          im not sure a pin is right there.
                                          Try read some the many tuts and see what they use for adress.

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

                                          @mrjj
                                          Now it works.
                                          i reached the slave-address each sensor, made a code like this

                                          char w1_address[16];
                                          const char* adr1  = "10-000803673bfb";
                                          DS18B20 w1Device1 (adr1);
                                          actualTemp1 = w1Device1.getTemp();
                                          

                                          And it's working.
                                          But unfortunately if i add a new sensor. i have to find out his address and add it to the code. its not only plug and play^^

                                          But now a basic c++ problem.
                                          I created a class:
                                          checktemperature.h

                                          #ifndef CHECKTEMPERATURE_H
                                          #define CHECKTEMPERATURE_H
                                          
                                          #include <settemperature.h>
                                          #include <readtemperature.h>
                                          #include <wiringPi.h>
                                          
                                          class CheckTemperature
                                          {
                                          private:
                                              SetTemperature S;
                                              ReadTemperature R;
                                          public:
                                              void CheckTemp();
                                              float TempEin;
                                              float TempAus;
                                          };
                                          
                                          #endif // CHECKTEMPERATURE_H
                                          
                                          

                                          checktemperature.cpp

                                          #include "checktemperature.h"
                                          
                                          void CheckTemperature::CheckTemp()
                                          {
                                              TempEin = S.getHystTemperature();
                                              TempAus = S.getHystTemperature();
                                          
                                              if (R.actualTemp1 <= TempEin) digitalWrite(31, LOW);
                                              else if (R.actualTemp1 >= TempAus) digitalWrite(31, HIGH);
                                          
                                              if (R.actualTemp2 <= TempEin) digitalWrite(26, LOW);
                                              else if (R.actualTemp2 >= TempAus) digitalWrite(26, HIGH);
                                          
                                              if (R.actualTemp3 <= TempEin) digitalWrite(27, LOW);
                                              else if (R.actualTemp3 >= TempAus) digitalWrite(27, HIGH);
                                          
                                              if (R.actualTemp4 <= TempEin) digitalWrite(28, LOW);
                                              else if (R.actualTemp4 >= TempAus) digitalWrite(28, HIGH);
                                          
                                              if (R.actualTemp5 <= TempEin) digitalWrite(29, LOW);
                                              else if (R.actualTemp5 >= TempAus) digitalWrite(29, HIGH);
                                          }
                                          
                                          

                                          i call that funktion every 500ms in loop.
                                          But the values of R.actualTemp and S.getHystTemperature the value does not adjust, so they still at the moment when i start the program.
                                          Do you know whats wrong, cause i call that funktion every 500ms and at the beginning "TempEin= ..." and S.getHystTemperature(); is already changing^

                                          mrjjM 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