Hye, my project that i'm doing right now is to SEND AN SMS TO PHONE when the LED TURNED ON through the ARDUINO. I've made a code about the limit switch, but I dont know how to add the GSM code on it. My code are look like this :
int redPin = 8; // the number of pin for Red LED
int bluePin = 10; // the number of pin for Blue LED
int greenPin = 9; // the number of pin for Green LED
int rButton = 2; // the number of pin for Red switch
int bButton = 3; // the number of pin for Blue switch
int gButton = 4; // the number of pin for Green switch
void setup() {
// initialize the LED pin as an output:
pinMode(redPin, OUTPUT);
pinMode(bluePin, OUTPUT);
pinMode(greenPin, OUTPUT);
// initialize the Button pin as an input:
pinMode(rButton, INPUT);
pinMode(bButton, INPUT);
pinMode(gButton, INPUT);
}
void loop() {
int rstate = digitalRead(rButton);
int bstate = digitalRead(bButton);
int gstate = digitalRead(gButton);
if (rstate == HIGH) {
digitalWrite(redPin, HIGH);
delay(50);
}
if (rstate == LOW) {
digitalWrite(redPin, LOW);
}
if (bstate == HIGH) {
digitalWrite(bluePin, HIGH);
delay(50);
}
if (bstate == LOW) {
digitalWrite(bluePin, LOW);
}
if (gstate == HIGH) {
digitalWrite(greenPin, HIGH);
delay(50);
}
if (gstate == LOW) {
digitalWrite(greenPin, LOW);
}
}
LimitSwitchCode.ino (1.03 KB)
Even a newbie with three posts should know this...
To post code and/or error messages:
- Use CTRL-T in the Arduino IDE to autoformat your complete code.
- Paste the complete autoformatted code between code tags (the </> button)
so that we can easily see and deal with your code.
- Paste the complete error message between code tags (the </> button)
so that we can easily see and deal with your messages.
- If you already posted without code tags, you may add the code tags by
editing your post. Do not change your existing posts in any other way.
You may make additional posts as needed.
- Please provide links to any libraries that are used
(look for statements in your code that look like #include ). Many libraries
are named the same but have different contents.
Before posting again, you should read the three locked topics at the top of the Programming Questions forum, and any links to which these posts point.
If your project involves wiring, please provide a schematic and/or a wiring diagram and/or a clear photograph of the wiring.
Good Luck!
On the internet, all caps is considered shouting. "HOW TO MAKE THE ARDUINO GSM SEND MESSAGE ?" as a title is not considered polite. You may want to edit your post to adjust the title. "How to Make the Arduino GSM Shield Send a Message ?" would be a better title after the code gets adjusted and reposted.
Sorry I really dont know about the Auto Format and i didnt expect that my title message are rude. Maybe its my mistake, sorry once again
The Arduino by itself can not send an SMS. It needs some extra hardware to do that. The usual choices are a GPRS shield or an Ethernet or Wifi shield, using a web service to do the actual sending.
What hardware have you added, or are you planning to add, to the Arduino?