Closed B504now closed 10 years ago
It accepts an Arduino String object. Here are the method definitions: https://github.com/sparkfun/phant-arduino/blob/master/Phant/Phant.h#L30
Anything found in the constructor section should work: http://arduino.cc/en/Tutorial/StringConstructors
@B504now it looks like your example sketch is missing several lines of code for working with the Xbee Wifi modules (between this and issue #88). I'd recommend checking out this tutorial section here on logging using phant and the XBee Wifi modules. Keep in mind if you changed your hardware around or are using a different set up, that may also be affecting your code's functionality.
Hmmm. I don't think so since it's posting very nicely to my server here. Give me an example ?
Thanks
Bill Dickenson
302 521 3565
On Wednesday, August 27, 2014 11:20 AM, Toni Klopfenstein notifications@github.com wrote:
@B504now it looks like your example sketch is missing several lines of code for working with the Xbee Wifi modules (between this and issue #88). I'd recommend checking out this tutorial section here on logging using phant and the XBee Wifi modules. Keep in mind if you changed your hardware around or are using a different set up, that may also be affecting your code's functionality. — Reply to this email directly or view it on GitHub.
The gateway error is a side effect of the problem with phant. I posted some new code this am. It's not the xbee thats causing the problem. But I have been through it , ran it, etc so if you see something I don't, tell me and I'll look. Thanks
Bill Dickenson
302 521 3565
On , Bill Dickenson b504now@yahoo.com wrote:
Hmmm. I don't think so since it's posting very nicely to my server here. Give me an example ?
Thanks
Bill Dickenson
302 521 3565
On Wednesday, August 27, 2014 11:20 AM, Toni Klopfenstein notifications@github.com wrote:
@B504now it looks like your example sketch is missing several lines of code for working with the Xbee Wifi modules (between this and issue #88). I'd recommend checking out this tutorial section here on logging using phant and the XBee Wifi modules. Keep in mind if you changed your hardware around or are using a different set up, that may also be affecting your code's functionality. — Reply to this email directly or view it on GitHub.
@B504now & @ToniCorinne: I'm going to close all of these separate bugs, and use sparkfun/phant-arduino#1 to track this issue since it is an issue with the Arduino client and not phant itself.
I am trying to pass a string to phant.add but I am guessing from the errors that it's a const.
include <avr/pgmspace.h>
include
// This is the set of variables we will feed to PHANT --- we have // iVal which is the count of data elements // WeatherData which is the float table for all the results. Yes, I waste a bit of memory // lValt has the table of labels for phant so it doesn't stay in memory //
int iData = 20; float WeatherData[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
prog_char wlbl_0[] PROGMEM = "avgwindspeed"; prog_char wlbl_1[] PROGMEM = "cloudcover"; prog_char wlbl_2[] PROGMEM = "gustdir"; prog_char wlbl_3[] PROGMEM = "gustspeed"; prog_char wlbl_4[] PROGMEM = "humi"; prog_char wlbl_5[] PROGMEM = "humidity"; prog_char wlbl_6[] PROGMEM = "interval"; prog_char wlbl_7[] PROGMEM = "lightlvl"; prog_char wlbl_8[] PROGMEM = "lightningdistance"; prog_char wlbl_9[] PROGMEM = "powerlvl"; prog_char wlbl_10[] PROGMEM = "pressure"; prog_char wlbl_11[] PROGMEM = "pressurei"; prog_char wlbl_12[] PROGMEM = "raindaily"; prog_char wlbl_13[] PROGMEM = "rainfallrate"; prog_char wlbl_14[] PROGMEM = "temp"; prog_char wlbl_15[] PROGMEM = "tempi"; prog_char wlbl_16[] PROGMEM = "uv"; prog_char wlbl_17[] PROGMEM = "winddir"; prog_char wlbl_18[] PROGMEM = "windi"; prog_char wlbl_19[] PROGMEM = "windspeed";
PROGMEM const char *weatherLabel[] = // Table of labels {
wlbl_0, wlbl_1, wlbl_2, wlbl_3, wlbl_4, wlbl_5, wlbl_6, wlbl_7, wlbl_8, wlbl_9, wlbl_10, wlbl_11, wlbl_12, wlbl_13, wlbl_14, wlbl_15, wlbl_16, wlbl_17, wlbl_18, wlbl_19 };
char buffer[20]; // make sure this is large enough for the largest string it must hold
define AVGWINDSPEED 0
define CLOUDCOVER 1
define GUSTDIR 2
define GUSTSPEED 3
define HUMI 4
define HUMIDITY 5
define INTERVAL 6
define LIGHTLVL 7
define LIGHTNINGDISTANCE 8
define POWERLVL 9
define PRESSURE 10
define PRESSUREI 11
define RAINDAILY 12
define RAINFALLRATE 13
define TEMP 14
define TEMPI 15
define UV 16
define WINDDIR 17
define WINDI 18
define WINDSPEED 19
// https://data.sparkfun.com/input/rooqN2WA3pSDWaKjLjYA?private_key=jkk7wvr2nZsb5VwPdPyr&baro=28.14&blvl=17.16&cld=3.83&drn=12.09&hum=4.53&lght=22.50&lng=26.22&rn=0.12&tmp=20.69&uv=26.26&was=10.00&wd=6.04&wg=3.76&wgd=26.83&ws=26.81 char response[12]; int returncode = 0;
///////////////// // Phant Stuff // ///////////////// Phant phant("data.sparkfun.com", "rooqN2WA3pSDWaKjLjYA", "jkk7wvr2nZsb5VwPdPyr");
/////////// // Setup // /////////// void setup() { // Set up serial ports: Serial.begin(9600); Serial.print(F("Memory Available is :")); Serial.print(availableMemory()); }
////////// // Loop // ////////// void loop() { Serial.println(F("Start phant")); for (int i=0;i<iData;i++) { strcpy_P(buffer, (char*)pgm_read_word(&(weatherLabel[i]))); // Necessary casts and dereferencing, just copy. phant.add(buffer,WeatherData[i]); Serial.println(buffer); } Serial.println(phant.post()); delay(5000);
};
// *** Utilities *** // free RAM check for debugging. SRAM for ATmega328p = 2048Kb. int availableMemory() { // Use 1024 with ATmega168 int size = 2048; byte buf; while ((buf = (byte ) malloc(--size)) == NULL); free(buf); return size; }