Anyone actually done this at all ....
This code compiles OK .... but appears not to upload anything to ThingSpeak ...
What I am getting cofused with is whilst I am able to get Serial output, I do not then seem to be able to use the defined Temp1 and Temp2 as variables to update the fields in ThingSpeak .... am I asking to much from the Arduino?.
[color=green][i]Usual Ethernet Setup, and Thingspeak setup above this [/i][/color]
// 1 Wire Data wire is plugged into Digital pin 12 on the Arduino
#define ONE_WIRE_BUS 12
// 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);
// Assign the addresses of the 1-Wire temp sensors.
DeviceAddress Temp1 = { 0x28, 0xFF, 0x7F, 0x71, 0x2C, 0x04, 0x00, 0x79 };
DeviceAddress Temp2 = { 0x28, 0xEC, 0xAB, 0x1E, 0x00, 0x00, 0x80, 0xA8 };
[color=green][i]Would rerally like to do it this way, as I have about 10-15 sensors longterm that I want to keep data on. This is a test bed program only. [/i][/color]
void setup(void)
{
// start serial port
Serial.begin(9600);
// Start up the library
sensors.begin();
// set the resolution to 10 bit (good enough?)
sensors.setResolution(Temp1, 10);
sensors.setResolution(Temp2, 10);
ThingSpeak.begin(client);
}
/*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);
Serial.print(" F: ");
Serial.print(DallasTemperature::toFahrenheit(tempC));
}
}*/
void loop (void)
{
//delay(10000);
Serial.print("Getting temperatures...\n\r");
/* sensors.requestTemperatures();
Serial.print("Temp 1 is: ");
printTemperature(Temp1);
Serial.print("\n\r");
Serial.print("Temp 2 is: ");
printTemperature(Temp2);
Serial.print("\n\r");
Serial.print("\n\r");
delay(200);
}
*/
//Update the ThingSpeak Channel
float pinVoltage = digitalRead(12) ;
ThingSpeak.setField(1,pinVoltage);
pinVoltage = digitalRead(12) ;
ThingSpeak.setField(2,pinVoltage);
// Write the fields that you've set all at once.
ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
Serial.print("Temperatures Uploaded to Cloud...\n\r");
delay(80000); // ThingSpeak will only accept updates every 15 seconds.
}
[ENDCODE]