Hello,
Who can help me make a Custom Arduino Node in Embrio of a DS18B20 digital temperature measurement? I have a working Arduino sketch with 10x DS18B20 digital temperature measurement. Just started with the includes and translation to Embrio but gives me no response in Embrio.
Next program is a working Arduino sketch:BigGrin
#include <OneWire.h>
#include <DallasTemperature.h>
// Data wire is plugged into pin 3 on the Arduino
#define ONE_WIRE_BUS 3
// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
DeviceAddress T1 = { 0x28, 0x3A, 0x23, 0x8D, 0x05, 0x00, 0x00, 0xFB };
DeviceAddress T2 = { 0x28, 0x34, 0xA1, 0x8C, 0x05, 0x00, 0x00, 0x2F };
DeviceAddress T3 = { 0x28, 0x76, 0xE3, 0x8C, 0x05, 0x00, 0x00, 0x5E };
DeviceAddress T4 = { 0x28, 0xCD, 0x2E, 0x8E, 0x05, 0x00, 0x00, 0x68 };
DeviceAddress T5 = { 0x28, 0x85, 0x2C, 0x8E, 0x05, 0x00, 0x00, 0x3F };
DeviceAddress T6 = { 0x28, 0x38, 0x0D, 0x8D, 0x05, 0x00, 0x00, 0xCF };
DeviceAddress T7 = { 0x28, 0x60, 0x27, 0x8D, 0x05, 0x00, 0x00, 0x05 };
DeviceAddress T8 = { 0x28, 0x2D, 0x89, 0x8D, 0x05, 0x00, 0x00, 0xAB };
DeviceAddress T9 = { 0x28, 0xF3, 0x1F, 0x8D, 0x05, 0x00, 0x00, 0x57 };
DeviceAddress T10 = { 0x28, 0xA6, 0x2B, 0x8D, 0x05, 0x00, 0x00, 0x09 };
void setup(void)
{
// start serial port
Serial.begin(9600);
// Start up the library
sensors.begin();
// set the resolution to 12 bit (better!)
sensors.setResolution(T1, 12);
sensors.setResolution(T2, 12);
sensors.setResolution(T3, 12);
sensors.setResolution(T4, 12);
sensors.setResolution(T5, 12);
sensors.setResolution(T6, 12);
sensors.setResolution(T7, 12);
sensors.setResolution(T8, 12);
sensors.setResolution(T9, 12);
sensors.setResolution(T10, 12);
}
void printTemperature(DeviceAddress deviceAddress)
{
float tempC = sensors.getTempC(deviceAddress);
if (tempC == -127.00) {
Serial.print("Error getting temperature");
} else {
// Serial.print("C: ");
Serial.print(tempC);
}
}
void loop(void)
{
delay(1000);
//Serial.print("Getting temperatures...\n\r");
sensors.requestTemperatures();
Serial.print("{T1,T,");
printTemperature(T1);
Serial.print(" }");
Serial.print("{T2,T,");
printTemperature(T2);
Serial.print(" }");
Serial.print("{T3,T,");
printTemperature(T3);
Serial.print(" }");
Serial.print("{T4,T,");
printTemperature(T4);
Serial.print(" }");
Serial.print("{T5,T,");
printTemperature(T5);
Serial.print(" }");
Serial.print("{T6,T,");
printTemperature(T6);
Serial.print(" }");
Serial.print("{T7,T,");
printTemperature(T7);
Serial.print(" }");
Serial.print("{T8,T,");
printTemperature(T8);
Serial.print(" }");
Serial.print("{T9,T,");
printTemperature(T9);
Serial.print(" }");
Serial.print("{T10,T,");
printTemperature(T10);
Serial.print(" }");
}
Thanks for reading.
Kind regards,
Jitze.