newbie code query => Arduino & DS18B20

For the discussion of Arduino related topics.

Moderator: phalanx

Post Reply
miyayoung
Posts: 1
Joined: Fri Jul 28, 2017 12:46 am

newbie code query => Arduino & DS18B20

Post by miyayoung » Fri Jul 28, 2017 12:48 am

I have been using picaxe for a few years but now playign with arduino and trying to learn how it all works.

I have a couple of arduinos talking via the HOPERF library successfully and now want to send some meaningful data over the link.

I have the code for the DS18B20 running on the client aurduino and "printing" the temp value to the PC via USB but just not sure how to get it into the HOPERF commands to send over the RF. Here is a bit of the code. The 2nd line is where the data is sent over the HOPERF. What i need to do is replace the string "test" with the data returned by the (sensors.getTebyCByIndex(0)) command from the 4th line. Here is the datesheet of ds18b20.

sensors.requestTemperatures(); // Send the command to get temperatures
client.sendto(11, (uint8_t*)"test\n", 6); // Includes the NUL at the end of the string
Serial.print("sending\n");
Serial.print(sensors.getTempCByIndex(0)); //prints the temp value over the USB

Any clues anyone?? I prefer to learn but doing stuff like this - and yes i did do the "BLINK" thing first! I find doing something i find useful helps me learn faster :-)

I am struggling a bit with working out the docs as there doesnt seem to be a nice "manual" liek the picaxes to follow :-(

Post Reply