Sample code to HTTP using SIM900 and Arduino

Microcontroller Topics

Sample code to HTTP using SIM900 and Arduino

Postby Saman » Mon Feb 03, 2014 5:57 pm

User avatar
Saman
Support Team
Support Team
 
Posts: 816
Joined: Fri Jul 31, 2009 5:02 pm
Cash on hand: 152,553.20
Location: Mount Lavinia
Medals: 1
EC_Achievment (1)

Invitations sent: 44
Registered friends: 1
Reputation point: 37
Staff Sergeant

Re: Sample code to HTTP using SIM900 and Arduino

Postby Saman » Mon Feb 03, 2014 5:59 pm

User avatar
Saman
Support Team
Support Team
 
Posts: 816
Joined: Fri Jul 31, 2009 5:02 pm
Cash on hand: 152,553.20
Location: Mount Lavinia
Medals: 1
EC_Achievment (1)

Invitations sent: 44
Registered friends: 1
Reputation point: 37
Staff Sergeant

Re: Sample code to HTTP using SIM900 and Arduino

Postby sodiptakarina » Tue Oct 28, 2014 9:59 am

Hallo,

i am interested in your project. Now, i have project to turn a lamp ON or OFF from internet by using GSM/GPRS Shield SIM900 and also Arduino UNO . I am newbie in microcontroller, so I want ask you, could you give me a flowchart or example code to read data from Internet via GPRS, so i can start this project with good step. Thx in advance
User avatar
sodiptakarina
 
Posts: 2
Joined: Tue Oct 28, 2014 8:34 am
Cash on hand: 173.40

Invitations sent: 0
Registered friends: 0
Reputation point: 0
Lance Corporal

Re: Sample code to HTTP using SIM900 and Arduino

Postby SevenZero » Wed Oct 29, 2014 5:25 pm

If you are not too familiar with SIM900, GPRS, etc... it is better you buy the SIM900 based GPRS shield for Arduino. There are Arduino libraries, example codes written for this shield in the internet that you can easily use. Good luck!

User avatar
SevenZero
Support Team
Support Team
 
Posts: 286
Joined: Sun Nov 01, 2009 3:07 pm
Cash on hand: 201,474.40

Invitations sent: 0
Registered friends: 0
Reputation point: 10
Corporal

Re: Sample code to HTTP using SIM900 and Arduino

Postby sodiptakarina » Fri Oct 31, 2014 12:35 am

thank you, but i have a little problem, could you help me please?
I compile this code to my arduino+gsm sim900 shield, this code works good, but what should I do next, so i can turn the lamp on/off from web?
i hope, you can give me a way to solve this problem . . :)

#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("xxxxx", "", ""))
     Serial.println("status=ATTACHED");
   else Serial.println("status=ERROR");
   delay(1000);
   gsm.SimpleWriteln("AT+CIFSR");
   delay(5000);
   gsm.WhileSimpleRead();  
   inet.httpGET("lxxxx.xxx", 80, "/index.php?lamp=1&statt=0", msg, 50);
 }
};
void loop()
{
 serialswread();
};
void serialswread(){
 gsm.SimpleRead();
}
User avatar
sodiptakarina
 
Posts: 2
Joined: Tue Oct 28, 2014 8:34 am
Cash on hand: 173.40

Invitations sent: 0
Registered friends: 0
Reputation point: 0
Lance Corporal


Return to Microcontrollers

Who is online

Users browsing this forum: No registered users and 2 guests

cron