Pages: 1 [2]   Go Down
Author Topic: Smoke Sensor + arduino uno + gsm module shield  (Read 4078 times)
0 Members and 2 Guests are viewing this topic.
Leighton Buzzard, UK
Offline Offline
Edison Member
*
Karma: 20
Posts: 1318
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

please wrap [ code] [ /code] tags around your code so we can read it properly (no spaces in the tags)
Code:
your code here
Logged

there are only 10 types of people
them that understands binary
and them that doesn't

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Honestly i really dont know what is that mean...

I've just seen this codes in the arduino software...

There's a post in this site about smoke sensor + with arduino + ang GSM.. But the function of the codes is to make a phone call...

Hmmm.. Can i use that codes?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
#include <GSM.h>

#define PINNUMBER ""

// initialize the library instance
GSM gsmAccess; // include a 'true' parameter for debug enabled
GSM_SMS sms;

void setup()
{
  // initialize serial communications
  Serial.begin(9600);

  Serial.println("SMS Messages Sender");

  // connection state
  boolean notConnected = true;

  // Start GSM shield
  // If your SIM has PIN, pass it as a parameter of begin() in quotes
  while(notConnected)
  {
    if(gsmAccess.begin(PINNUMBER)==GSM_READY)
      notConnected = false;
    else
    {
      Serial.println("Not connected");
      delay(1000);
    }
  }

  Serial.println("GSM initialized");
}

void loop()
{

  Serial.print("Enter a mobile number: ");
  char remoteNumber[20];  // telephone number to send sms
  readSerial(remoteNumber);
  Serial.println(remoteNumber);

  // sms text
  Serial.print("Now, enter SMS content: ");
  char txtMsg[200];
  readSerial(txtMsg);
  Serial.println("SENDING");
  Serial.println();
  Serial.println("Message:");
  Serial.println(txtMsg);

  // send the message
  sms.beginSMS(remoteNumber);
  sms.print(txtMsg);
  sms.endSMS();
  Serial.println("\nCOMPLETE!\n");
}

/*
  Read input serial
 */
int readSerial(char result[])
{
  int i = 0;
  while(1)
  {
    while (Serial.available() > 0)
    {
      char inChar = Serial.read();
      if (inChar == '\n')
      {
        result = '\0';
        Serial.flush();
        return 0;
      }
      if(inChar!='\r')
      {
        result = inChar;
        i++;
      }
    }
  }
}
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is the code that I'm using... I've got this code from the example codes in the software of arduino...
Logged

Leighton Buzzard, UK
Offline Offline
Edison Member
*
Karma: 20
Posts: 1318
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

there are several things wrong with that code
where did you get it from (link)
the define for PINNUMBER is just silly
Logged

there are only 10 types of people
them that understands binary
and them that doesn't

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I got that codes from the arduino website.. Here's the link..


http://arduino.cc/en/Tutorial/GSMExamplesSendSMS


Can you please help me about the right codes...


Thank you so much
smiley
Logged

Leighton Buzzard, UK
Offline Offline
Edison Member
*
Karma: 20
Posts: 1318
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

does that sketch load?
does it run?
what results do you get?
Logged

there are only 10 types of people
them that understands binary
and them that doesn't

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Good day:)
sorry for late reply...

Yup that's the sketch code...
I don't know if that codes run on my arduino and GSM. Because everytime I upload the codes,
It comes to this kind of error..

avrdude: stk500_getsync(): not in sync: resp=0x00


And I don't know how to fix it:(
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 551
Posts: 46240
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Because everytime I upload the codes,
It comes to this kind of error..
With or without the GSM shield in place? If it's with, remove it when uploading code.

If it's without, can you upload any sketch? If not, there's a whole troubleshooting section in the documentation that came with the Arduino. Happy reading.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you. Will try that and give u feedback soon.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Please advise code with smoke censor. Thank you
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 551
Posts: 46240
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Please advise code with smoke censor.
My code is to censor anyone blowing smoke up my ass. But, I doubt that's what you mean.

One can't write code for a smoke sensor without knowing what this mysterious sensor is.

Feels great to wait until the last minute, eh?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Good day sir, you said that, when I upload the codes the GSM must not coonected to the arduino...
After that, what is the next step? When I'm done uploading the codes..
And who will be the one that triggers the arduino?


Thanks
Logged

Pages: 1 [2]   Go Up
Jump to: