Can anyone give me some assistance in getting a second Channel working. When I compile a Sketch with a second channel write i get an error for the following write instruction. (ThingSpeak.writeField(myChannelNumber,2, gallons ,myWriteAPIKey);)
"call of overloaded 'writeField(long unsigned int&, int, long unsigned int&, const char*&)' is ambiguous"
I'm thinking it's related to the fields data type but have no idea on how to fix. My Sketch follows...
Larry
***************************
// Logs flow in gallons/minute from residential water meter
#include "ThingSpeak.h"
#include
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
EthernetClient client;
unsigned long myChannelNumber = 90870;
const char * myWriteAPIKey = "xxxxxxxx";
byte sensorInterrupt = 0;
byte sensorPin = 2;
volatile byte pulseCount;
unsigned long oldTime;
unsigned long gallons;
void setup()
{
Ethernet.begin(mac);
ThingSpeak.begin(client);
Serial.begin(9600);
pinMode(sensorPin, INPUT);
digitalWrite(sensorPin, HIGH);
gallons = 0;
pulseCount = 0;
oldTime = 0;
attachInterrupt(sensorInterrupt, pulseCounter, RISING);
}
void loop()
{
if((millis() - oldTime) > 60000)
{
oldTime = millis();
gallons = (gallons + pulseCount);
Serial.print("Pulse: ");
Serial.print(pulseCount);
Serial.print(" Gallons: ");
Serial.println(gallons);
ThingSpeak.begin (client);
ThingSpeak.writeField(myChannelNumber,1, pulseCount ,myWriteAPIKey);
ThingSpeak.writeField(myChannelNumber,2, gallons ,myWriteAPIKey);
pulseCount = 0;
}
}
void pulseCounter()
{
pulseCount++;
}