2:29 pm

April 1, 2020

Hy:
Frist of all excuseme for my inexperience to upload date with a SIM900.
My level of inglis it´s vry bad, by i will try
I open one chanel to upload the level of a thank.
The code works, and conect to ThinSpeak, by only send the first digit of the number I want to send.
If i want send 30. In a web to ThingSpeak goes up "3"
If i want send 9. In a web to ThingSpeak goes up "9" -----Good, but if i want send 10. In a web to ThingSpeak goes up "1"
I work with an Arduino Uno and a SIM900 (Mod: Efcom V1.2)
The code i'm using is this:
#include
/* Create object named SIM900 of the class SoftwareSerial */
SoftwareSerial SIM900(2,3);
void setup() {
SIM900.begin(9600); /* Define los Baudios de comunicación con el Monitor Serie */
Serial.begin(9600); /* Define los Baudios del Monitor Serie */
}
void loop() {
Serial.println("HTTP post method :");
Serial.print("AT\
\
");
SIM900.println("AT"); /* Verifica Funcionamiento SIM900 */
delay(5000);
ShowSerialData(); /* Imprime respuesta en el Monitor Serie */
delay(5000);
/* Configure bearer profile 1 */
Serial.print("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"\
\
");
SIM900.println("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\""); /* Conexion tipo GPRS */
delay(5000);
ShowSerialData();
delay(5000);
Serial.print("AT+SAPBR=3,1,\"APN\",\"movistar.es\"\
\
");
SIM900.println("AT+SAPBR=3,1,\"APN\",\"movistar.es\""); /* APN del proveedor */
delay(5000);
ShowSerialData();
delay(5000);
Serial.print("AT+SAPBR=1,1\
\
");
SIM900.println("AT+SAPBR=1,1"); /* Abre el GPRS */
delay(5000);
ShowSerialData();
delay(5000);
Serial.print("AT+SAPBR=2,1\
\
");
SIM900.println("AT+SAPBR=2,1"); /* Configura el GPRS */
delay(5000);
ShowSerialData();
delay(5000);
Serial.print("AT+HTTPINIT\
\
");
SIM900.println("AT+HTTPINIT"); /* Inicia el servicio HTTP */
delay(5000);
ShowSerialData();
delay(5000);
Serial.print("AT+HTTPPARA=\"CID\",1\
\
");
SIM900.println("AT+HTTPPARA=\"CID\",1"); /* Configura el identificador del portador HTTP */
delay(5000);
ShowSerialData();
delay(5000);
Serial.print("AT+HTTPPARA=\"URL\",\"api.thingspeak.com/update\"\
\
");
SIM900.println("AT+HTTPPARA=\"URL\",\"api.thingspeak.com/update\""); /* Pagina HTTP a la que se quiere acceder */
delay(5000);
ShowSerialData();
delay(5000);
Serial.print("AT+HTTPDATA=33,10000\
\
");
SIM900.println("AT+HTTPDATA=33,10000"); /*Sube datos tamaño 33 Bytes con un intervalo de 10 segundos
delay(2000);
ShowSerialData();
delay(2000);
Serial.print("api_key=5YE7A5RQE5W2D6OD&field1=30\
\
"); /*Dato a enviar */
SIM900.println("api_key=5YE7A5RQE5W2D6OD&field1=30");
delay(5000);
ShowSerialData();
delay(5000);
Serial.print("AT+HTTPACTION=1\
\
");
SIM900.println("AT+HTTPACTION=1"); /* Inicia la sesion de SUBIR dato */
delay(5000);
ShowSerialData();
delay(5000);
Serial.print("AT+HTTPTERM\
\
");
SIM900.println("AT+HTTPTERM"); /* Termina el servicio HTTP */
delay(5000);
ShowSerialData();
delay(5000);
Serial.print("AT+SAPBR=0,1\
\
");
SIM900.println("AT+SAPBR=0,1"); /* Cierra el GPRS */
delay(5000);
ShowSerialData();
delay(5000);
}
void ShowSerialData()
{
while(SIM900.available()!=0) /*Si el dato es valido en el puerto Serie */
Serial.write(char (SIM900.read())); /* Imprime el valor en el Monitor Serie*/
}
Can anyone give me a clue where is the error?
Regards
Most Users Ever Online: 166
Currently Online:
24 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
rw950431: 272
Vinod: 240
piajola: 95
turgo: 70
vespapierre: 63
Adarsh_Murthy: 62
Member Stats:
Guest Posters: 1
Members: 8665
Moderators: 1
Admins: 2
Forum Stats:
Groups: 3
Forums: 14
Topics: 1600
Posts: 5760
Newest Members:
huldacormier, bogart, estebanmateo93, mikewrite, onlinebusiness, winzy99Moderators: cstapels: 460
Administrators: Hans: 405, lee: 457