Ciao a tutti … sto impazzendo dietro un problema che non riesco a risolvere…
Utilizzo un Arduino con una SHIELD GSM/GPRS ( SIM900 ) ed ho realizzato un semplice CLIENT
#include "SIM900.h"
#include <SoftwareSerial.h>
#include "inetGSM.h"
InetGSM inet;
char msg[50];
char inSerial[50];
int i=0;
boolean started=false;
void setup()
{
Serial.begin(9600);
Serial.println("GSM Shield testing.");
if (gsm.begin(2400)){
Serial.println("\nstatus=READY");
started=true;
}
else Serial.println("\nstatus=IDLE");
if(started){
if (inet.attachGPRS("internet.wind", "", ""))
Serial.println("status=ATTACHED");
else Serial.println("status=ERROR");
delay(1000);
gsm.SimpleWriteln("AT+CIFSR");
delay(5000);
gsm.WhileSimpleRead();
inet.httpGET("www.maxiphone.it", 80, "/stato.php", msg, 50);
}
};
void loop()
{
gsm.SimpleRead();
};
Tutto OK , a video ottengo :
GSShield testing.
GSM Shield testing.
status=READY
status=ATTACHED
10.16.209.124
HTTP/1.1 200 OK
Date: Sat, 28 Sep 2013 09:50:57 GMT
Server: Apache
X-Powered-By: PleskLin
Connection: close
Content-Type: text/html
10
CLOSED
Ora il mio problema e che ho bisogno di attivare 2 LED in base al valore letto dalla pagina PHP come di seguito :
10 → LED1ON , LED2OFF
11 → LED1ON , LED2ON
01 → LED1OFF , LED2ON
00 → LED1OFF , LED2OFF
ma non riesco a creare una STRINGA che contiene il valore letto per poterlo utilizzare
La richiesta viene fatta alla classe SIM900.h nella parte di codice
void SIMCOM900::SimpleRead()
{
char datain;
if(_cell.available()>0){
datain=_cell.read();
if(datain>0){
Serial.print(datain);
}
}
}
che lo stampa solo a video…
Ormai e troppo tempo che ci sto provando , non conosco bene il C , qualcuno potrebbe darmi una dritta ?
Grazie 1000 a tutta la comunity