milimilo:
Hello Youen
Thank you very much for your lib.
My project is this one, and of course doesn't work:
I have an home automation zwave device that can read DS18B20 1Wire sensors. I would like to use my Arduino UNO to send some value through this zwave module.
May you give me a simple example of code that sends a value when pressing a simple button?
I'm blocked trying to give your library a value to send (using your demo .ino ...).
Sorry for my completely noob question (i am really new to Arduino and totally off the computing universe) and thank you very much for your help!
If I understand correctly, the zwave thing does not matter here, things would be exactly the same if you wanted to talk to a classical 1-wire master?
So what you want to do is emulate a DS18B20 sensor. For that, you need to understand the specific protocol of this device, you can look at this document for example : http://www.adafruit.com/datasheets/DS18B20.pdf, check the section "DS18B20 FUNCTION COMMANDS"
For a very basic operation, you'll need to understand the temperature conversion command, and how to send the response (which happens after the "read scratchpad" command, two bytes of the scratchpad are used to transmit the temperature). However, if your zwave device, which acts as a master, always sends configuration, or performs other operations, you might need to implement that part of the protocol as well.
Once you understand the protocol, implementing it with my library should be straightforward : as in the sample, you initialize the library with the device ROM (which may or may not be an official ROM number, but must have the correct family code), and register the event callback. This callback is a function that you write yourself, and will be called each time something happens (a byte is received, an error occurs, etc.). Then you'll need to react to the various commands that can be sent to a DS18B20 ("begin temperature conversion" and "read scratchpad" being the most important).
Communicating with your development PC using the serial port of the Arduino should help you in the process of understanding what happens in your program (so that you can see what command you have received, etc.)