XivelyDatastream invalid conversion from 'int' to 'const char*'
i trying send digital switch state xively should return 1 closed switch , 0 open. error message that says invalid conversion 'int' 'cont char*' new @ , better on hardware end programming appreciated.
#include <xively.h>
#include <xivelyclient.h>
#include <xivelydatastream.h>
#include <xivelyfeed.h>
#include <countingstream.h>
#include <b64.h>
#include <httpclient.h>
#include <onewire.h>
#include <dallastemperature.h>
#include <spi.h>
#include <ethernet.h>
//defines ds18b20
#define one_wire_bus 2
onewire onewire(one_wire_bus);
dallastemperature sensors(&onewire);
deviceaddress sensor1 = {
0x28, 0xbf, 0x24, 0xa6, 0x04, 0x00, 0x00, 0xe4};
deviceaddress sensor2 = {
0x28, 0xf3, 0x23, 0xa7, 0x04, 0x00, 0x00, 0x32};
deviceaddress sensor3 = {
0x28, 0x48, 0x16, 0xa7, 0x04, 0x00, 0x00, 0x9b};
//end defines ds18b20
//defines cosm ethernet
char xivelykey[] = "tqk5y9cwlwebzn3aqr2tdrkyiwk1wiaf7w1jq7rqaurtmpdy";
byte mac[] = {
0x90, 0xa2, 0xda, 0x0f, 0x25, 0xe1};
ethernetclient client;
xivelyclient cosmclient(client);
//end defines cosm ethernet
double s1 = 0;
double s2 = 0;
double s3 = 0;
#define mydelay 5000
char sensor1id[] = "inside";
char sensor2id[] = "boilersupply";
char sensor3id[] = "boilerreturn";
char sensor4id[] = "alarm one";
char sensor5id[] = "alarm two";
char sensor6id[] = "alarm three";
char sensor7id[] = "alarm four";
// digital pin 3-6 have dry contact alarms attached them give them names:
int alarmone = 3;
int alarmtwo = 4;
int alarmthree = 5;
int alarmfour = 6;
xivelydatastream datastreams[] = {
xivelydatastream(sensor1id, strlen(sensor1id), datastream_float),
xivelydatastream(sensor2id, strlen(sensor2id), datastream_float),
xivelydatastream(sensor3id, strlen(sensor3id), datastream_float),
// must convert int
xivelydatastream(alarmone, strlen(alarmone), datastream_string),
xivelydatastream(alarmtwo, strlen(alarmtwo), datastream_int),
xivelydatastream(alarmthree, strlen(alarmthree), datastream_int),
xivelydatastream(alarmfour, strlen(alarmfour), datastream_int),
};
xivelyfeed feed(1637716944, datastreams, 7);
void setup(void)
{
// start serial port
serial.begin(9600);
setupsensors();
while (ethernet.begin(mac) != 1)
{
serial.println("error getting ip address via dhcp, trying again...");
delay(15000);
}
}
void setupsensors()
{
sensors.begin();
// set resolution 10 bit (good enough?)
sensors.setresolution(sensor1, 12);
sensors.setresolution(sensor2, 12);
sensors.setresolution(sensor3, 12);
// make pushbutton's pin input:
pinmode(alarmone, input);
pinmode(alarmtwo, input);
pinmode(alarmthree, input);
pinmode(alarmfour, input);
}
float gettemperature(deviceaddress deviceaddress)
{
//get temperature, convert fahrenheit, , return
return dallastemperature::tofahrenheit(sensors.gettempc(deviceaddress));
}
void loop(void)
{
sensorloopandsend();
}
void sensorloopandsend()
{
// read input pin:
int alarmonestate = digitalread(alarmone);
int alarmtwostate = digitalread(alarmtwo);
int alarmthreestate = digitalread(alarmthree);
int alarmfourstate = digitalread(alarmfour);
// print out state of button:
serial.println(alarmonestate);
serial.println(alarmtwostate);
serial.println(alarmthreestate);
serial.println(alarmfourstate);
sensors.requesttemperatures();
s1 = gettemperature(sensor1);
s2 = gettemperature(sensor2);
s3 = gettemperature(sensor3);
serial.print("s1: ");
serial.println(s1);
serial.print("s2: ");
serial.println(s2);
serial.print("s3: ");
serial.println(s3);
if((s1 != 185) && (s2 != 185) && (s1 != 32) && (s2 != 32))
{
datastreams[0].setfloat(s1);
datastreams[1].setfloat(s2);
datastreams[2].setfloat(s3);
int ret = cosmclient.put(feed, xivelykey);
}
delay(mydelay);
}
#include <xively.h>
#include <xivelyclient.h>
#include <xivelydatastream.h>
#include <xivelyfeed.h>
#include <countingstream.h>
#include <b64.h>
#include <httpclient.h>
#include <onewire.h>
#include <dallastemperature.h>
#include <spi.h>
#include <ethernet.h>
//defines ds18b20
#define one_wire_bus 2
onewire onewire(one_wire_bus);
dallastemperature sensors(&onewire);
deviceaddress sensor1 = {
0x28, 0xbf, 0x24, 0xa6, 0x04, 0x00, 0x00, 0xe4};
deviceaddress sensor2 = {
0x28, 0xf3, 0x23, 0xa7, 0x04, 0x00, 0x00, 0x32};
deviceaddress sensor3 = {
0x28, 0x48, 0x16, 0xa7, 0x04, 0x00, 0x00, 0x9b};
//end defines ds18b20
//defines cosm ethernet
char xivelykey[] = "tqk5y9cwlwebzn3aqr2tdrkyiwk1wiaf7w1jq7rqaurtmpdy";
byte mac[] = {
0x90, 0xa2, 0xda, 0x0f, 0x25, 0xe1};
ethernetclient client;
xivelyclient cosmclient(client);
//end defines cosm ethernet
double s1 = 0;
double s2 = 0;
double s3 = 0;
#define mydelay 5000
char sensor1id[] = "inside";
char sensor2id[] = "boilersupply";
char sensor3id[] = "boilerreturn";
char sensor4id[] = "alarm one";
char sensor5id[] = "alarm two";
char sensor6id[] = "alarm three";
char sensor7id[] = "alarm four";
// digital pin 3-6 have dry contact alarms attached them give them names:
int alarmone = 3;
int alarmtwo = 4;
int alarmthree = 5;
int alarmfour = 6;
xivelydatastream datastreams[] = {
xivelydatastream(sensor1id, strlen(sensor1id), datastream_float),
xivelydatastream(sensor2id, strlen(sensor2id), datastream_float),
xivelydatastream(sensor3id, strlen(sensor3id), datastream_float),
// must convert int
xivelydatastream(alarmone, strlen(alarmone), datastream_string),
xivelydatastream(alarmtwo, strlen(alarmtwo), datastream_int),
xivelydatastream(alarmthree, strlen(alarmthree), datastream_int),
xivelydatastream(alarmfour, strlen(alarmfour), datastream_int),
};
xivelyfeed feed(1637716944, datastreams, 7);
void setup(void)
{
// start serial port
serial.begin(9600);
setupsensors();
while (ethernet.begin(mac) != 1)
{
serial.println("error getting ip address via dhcp, trying again...");
delay(15000);
}
}
void setupsensors()
{
sensors.begin();
// set resolution 10 bit (good enough?)
sensors.setresolution(sensor1, 12);
sensors.setresolution(sensor2, 12);
sensors.setresolution(sensor3, 12);
// make pushbutton's pin input:
pinmode(alarmone, input);
pinmode(alarmtwo, input);
pinmode(alarmthree, input);
pinmode(alarmfour, input);
}
float gettemperature(deviceaddress deviceaddress)
{
//get temperature, convert fahrenheit, , return
return dallastemperature::tofahrenheit(sensors.gettempc(deviceaddress));
}
void loop(void)
{
sensorloopandsend();
}
void sensorloopandsend()
{
// read input pin:
int alarmonestate = digitalread(alarmone);
int alarmtwostate = digitalread(alarmtwo);
int alarmthreestate = digitalread(alarmthree);
int alarmfourstate = digitalread(alarmfour);
// print out state of button:
serial.println(alarmonestate);
serial.println(alarmtwostate);
serial.println(alarmthreestate);
serial.println(alarmfourstate);
sensors.requesttemperatures();
s1 = gettemperature(sensor1);
s2 = gettemperature(sensor2);
s3 = gettemperature(sensor3);
serial.print("s1: ");
serial.println(s1);
serial.print("s2: ");
serial.println(s2);
serial.print("s3: ");
serial.println(s3);
if((s1 != 185) && (s2 != 185) && (s1 != 32) && (s2 != 32))
{
datastreams[0].setfloat(s1);
datastreams[1].setfloat(s2);
datastreams[2].setfloat(s3);
int ret = cosmclient.put(feed, xivelykey);
}
delay(mydelay);
}
please learn use [#]-button above when including code.
where error message occur? - each error message says function or linenumber found. best cut-n-paste whole error window.
blind guess (based on experience) 1 of libraries not compatible ide version using.
another guess passing integer function function expects string.
where error message occur? - each error message says function or linenumber found. best cut-n-paste whole error window.
blind guess (based on experience) 1 of libraries not compatible ide version using.
another guess passing integer function function expects string.
Arduino Forum > Using Arduino > Programming Questions > XivelyDatastream invalid conversion from 'int' to 'const char*'
arduino
Comments
Post a Comment