2014-03-28 1 views
0

Xively 웹 사이트의 데이터를 얻기 위해 Xively_GPRS-master 라이브러리 (https://github.com/Seeed-Studio/Xively_GPRS)에서이 예제를 사용하려고합니다. 아두 이노에 대한 일련 모니터 :"Xively GPRS-master library"arduino 용 sim900 icomsat shield와 함께 얻는 예

나는 icomsat Itead 스튜디오에서 아두 이노 1.1 sim900 기반의 방패를 사용하고

"Xively 예

IP = 191.171.127.94에서 읽기".

누군가 나를 도울 수 있습니까? 고맙습니다!

#include <GPRSClient.h> 
#include <Xively.h> 
#include <SoftwareSerial.h> 

#define PIN_TX 2 
#define PIN_RX 3 

// Your Xively key to let you upload data 
char xivelyKey[] = "yGr24HFXpc2IVMACSdmyypR9d6ubk8XX2f3RRFJ2phhR96AR"; 

// Define the string for our datastream ID 
char sensorId[] = "sensor"; 

XivelyDatastream datastreams[] = { 
    XivelyDatastream(sensorId, strlen(sensorId), DATASTREAM_FLOAT), 
}; 
// Finally, wrap the datastreams into a feed 
XivelyFeed feed(675207838, datastreams, 1 /* number of datastreams */); 

char apn[] = "tim.br"; 
char user[] = "tim"; 
char pass[] = "tim"; 
GPRSClient gprs(PIN_TX,PIN_RX,4800,apn,user,pass); 
XivelyClient xivelyclient(gprs); 

void setup() { 
    // put your setup code here, to run once: 
    Serial.begin(4800); 

    Serial.println("Reading from Xively example"); 
    Serial.println(); 

    gprs.init(); 
    while(false == gprs.join()) { 
    Serial.println("connect error"); 
    delay(2000); 
    } 

    // successful DHCP 
    Serial.print("IP ="); 
    Serial.println(gprs.getIPAddress()); 
} 

void loop() { 
    int ret = xivelyclient.get(feed, xivelyKey); 

    if (ret > 0){ 
    Serial.println("Datastream is..."); 
    Serial.println(feed[0]); 
    Serial.print("Temperature is: "); 
    Serial.println(feed[0].getFloat()); 
    } 


    Serial.println(); 
    delay(15000UL); 
} 

답변

0

무엇이 문제인지 여기에 있습니다. 직렬 모니터 출력을 게시 할 수 있습니까? 또한 Xively Workbench 요청 로그에 요청이 표시됩니까? 그것은 확인해야 할 첫 번째 장소가 될 것입니다.