I have connected a DS18B20 and an OLED display, so now I can fully run and test your sketch.
While doing so, I discovered that the DS18B20 example has the 4K7 pull-up and the VCC of the sensor connected to 5.0 V. This injects a small current into the Z-Wave SoC because it is a 3.3V chip (and due to the voltage drop across a diode it is actually more like 3.0 V) and you should not pull an input above that supply of the SoC + 0.3 V. It is not a lot of current, but I think it is technically incorrect. I have connected the resistor and the sensor to 3V3 output of the Z-Uno instead, the DS18B20 is happy with that!
float conversion
-
- Posts: 255
- Joined: 26 Jul 2015 17:29
Re: float conversion
Are you sure about the ending brace? ) -> }. Is it local or global definition?
Those are constants that should be defined in your lib, they are not well known.
-
- Posts: 255
- Joined: 26 Jul 2015 17:29
Re: float conversion
PoltoS, your previous post suddenly made me realize that I am confused again! I installed coco82's sketch and I did not use any other library... It just works, including the OLED display! It has been running for 12h now and it is still display temperature and the green LED is still blinking.
Let me go back to one of your previous posts:
https://github.com/fdebrabander/Arduino ... 2C-library
And I see:
#define En B00000100 // Enable bit
#define Rw B00000010 // Read/Write bit
#define Rs B00000001 // Register select bit
The SDCC compiler used in the Z-Uno framewark does not like that, it wants a numerical constant to begin with 0 (zero), like this:
#define En 0B00000100 // Enable bit
#define Rw 0B00000010 // Read/Write bit
#define Rs 0B00000001 // Register select bit
Anyway, I would not try to fix that "Arduino-LiquidCrystal-I2C-library" but remove it from your sketch and use the Z-Uno built-in oled library.
Do I makes sense? Can you try this?
Let me go back to one of your previous posts:
If I google that, I get this library:coco82 wrote: ↑30 Sep 2017 18:09First, I took the Arduino LiquidCrystal_I2C library, and I made few changes to make it works with Z-Uno. It's small changes, and I don't remember all I did, but :
- the array declaration with default values don't work:
uint8_t row_offsets[4] = {0x00, 0x40, 0x14, 0x54); // default values are ignored
- in the header, the binary constants (En, Rs, Rw) make a compilator error. I converse it to hex constant.
In my program, I receive a temperature from a DS18B20 sensor, and I try to print it on a I2C LCD print. Sometimes, it works once or twice but after it starts to print special symbols et fills the screen. It seems that the Serial always works.
Maybe, it comes from the library... I can send you the files if you want.
https://github.com/fdebrabander/Arduino ... 2C-library
And I see:
#define En B00000100 // Enable bit
#define Rw B00000010 // Read/Write bit
#define Rs B00000001 // Register select bit
The SDCC compiler used in the Z-Uno framewark does not like that, it wants a numerical constant to begin with 0 (zero), like this:
#define En 0B00000100 // Enable bit
#define Rw 0B00000010 // Read/Write bit
#define Rs 0B00000001 // Register select bit
Anyway, I would not try to fix that "Arduino-LiquidCrystal-I2C-library" but remove it from your sketch and use the Z-Uno built-in oled library.
Do I makes sense? Can you try this?
Meet me here: https://forum.fibaro.com/index.php?/pro ... rgebruers/ or here: memberlist.php?mode=viewprofile&u=564463
-
- Posts: 255
- Joined: 26 Jul 2015 17:29
Re: float conversion
I have some good news... or should I say "bad news"! The green LED stopped blinking!
I have now made one change and I have to admit that this is a long shot. But personally I think it makes the display a bit nicer too.
Instead of:
I now do:
For debugging, i decreased the delay from 30 to 3 seconds and I also report at each run of the loop. If we are lucky, this speeds up the test. Let's wait and see.
I think this issue has another cause, but at the moment I am out of ideas.
I have now made one change and I have to admit that this is a long shot. But personally I think it makes the display a bit nicer too.
Instead of:
Code: Select all
oled.print(temperature);
Code: Select all
oled.print(temperature, 1);
I think this issue has another cause, but at the moment I am out of ideas.
Meet me here: https://forum.fibaro.com/index.php?/pro ... rgebruers/ or here: memberlist.php?mode=viewprofile&u=564463
Re: float conversion
First, thanks to spend times on my problem, even if I found a different way to move forward.
For the DS18B20 voltage, I did like the example and it works fine. My project isn't running all the day (yet), so I have no feedback for the moment.
Peter, you have found the library I used. I can't used the OLED library, because LCD screen and OLED screen are different kind of screen. The chips, and so the instructions are differents.
My screen is like that:
https://www.amazon.fr/dp/B00MODAKM4/ref ... w=g&hvqmt=
For the DS18B20 voltage, I did like the example and it works fine. My project isn't running all the day (yet), so I have no feedback for the moment.
Peter, you have found the library I used. I can't used the OLED library, because LCD screen and OLED screen are different kind of screen. The chips, and so the instructions are differents.
My screen is like that:
https://www.amazon.fr/dp/B00MODAKM4/ref ... w=g&hvqmt=
Re: float conversion
To solve your problem with
you need to include Binary.h. This is because Bnnnnnnnn is not ANSI C form.
Oh, those lazy people from the Arduino world! An include file not to write the leading zero!
Code: Select all
#define En B00000100 // Enable bit
#define Rw B00000010 // Read/Write bit
#define Rs B00000001 // Register select bit
Oh, those lazy people from the Arduino world! An include file not to write the leading zero!
-
- Posts: 255
- Joined: 26 Jul 2015 17:29
Re: float conversion
@coco82 I recognize that type of display, I "bitbang" it on my arduino Regarding injecting current into the pin of a microprocessor, if it is high enough the chip might latch-up and get destroyed. I have a certain Microchip mcu, and if you inject 1 mA on a digital pin then the ADC gets less accurate! So it always worries me to see 5V connected to a 3 V circuit...
@PoltoS I did not know about that Binary.h... And I like your style of humour
@PoltoS I did not know about that Binary.h... And I like your style of humour
Meet me here: https://forum.fibaro.com/index.php?/pro ... rgebruers/ or here: memberlist.php?mode=viewprofile&u=564463
Re: float conversion
Maybe we have here the same problem, I saw while write an float to the OLED display with oled.print(...)?
-
- Posts: 255
- Joined: 26 Jul 2015 17:29
Re: float conversion
I think so, can you please have a look at this post for a workaround (printing two integers instead of a float):
viewtopic.php?f=3427&t=25514&start=20
viewtopic.php?f=3427&t=25514&start=20
Meet me here: https://forum.fibaro.com/index.php?/pro ... rgebruers/ or here: memberlist.php?mode=viewprofile&u=564463