Hi everyone,
Can someone of you help me with a piece of code as example: I want to automatically send a predefined SMS to a predefined number if a variable contains a certain value?
This would be the pseudo code:
if VariableSend == 1 then
send SMS text "hello world" to phone nr. 1234567890
Well maybe I am luckier with this question:
I have this code that sends me a automatic predefind text via SMS when a SMS text is received but I want to receive the content of a variable which I can not succeed for some reason.
[code] if (LSMS.available()) // if received a SMS from another cellphone
{
LSMS.remoteNumber(num, 20);
LSMS.remoteContent(buf_contex, 50);
sprintf(buffer, "Get new sms, content: %s, number: %s \r\n", buf_contex, num);
Serial.println(buffer);
if (strcmp("GPS", (char*)buf_contex) == 0) // if the SMS content is 'GPS', then send the GPS information of RePhone back to the sender
{
//change var "buttonPushCounter" with "txt" to be automatically sent back when sms with GPS text is received
sprintf(buffer, "buttonPushCounter", buttonPushCounter = 0);
Serial.println(buffer);
if (LSMS.ready())
{
LSMS.beginSMS(num);
LSMS.print(buffer);
if (LSMS.endSMS()) Serial.println("SMS sent ok!");
else Serial.println("SMS send fail!");
}
else Serial.println("SMS no ready!");
}
}
LSMS.flush();
//}
[/code]
The code is from Dog Collar example.
Thank you!
P.S. unbelievable, after more than 400 views nobody had any advice for my previous question
Thanks dbelam,
Only by reading the forum on and on and on is clear that is not a vibe community yet but hopefully it will one day.
Fore sure some Arduino pros are scooping, I expected at least SeeedStudio moderators if any …
Should I switch and forget all the code I learn in Arduino during a few months and go with Eclipse? it looks so intimidating from a beginner point of view (at least mine). I do not think there are more RePhone specific resource for Eclipse in C++ (is it C++ right?)
I am open to listen if you can list a few pros for Eclipse? but remember this I am learning over the night at home and I do a nice progress by using Arduino so why should I start from 0 again ?
Any way I knew you are not on Arduino but on Eclipse and I do appreciate your input, at least there is someone who replies.
By the way, I keep uploading your project page regarding the OS but nothing moves there for like a month … I am following that page so add something to it, whatever it is …
Well still struggling with code, the below code to push a button and send a SMS.
// #########################################
buttonSendState = digitalRead(button_Send_onPin);
if (buttonSendState != lastButtonSendState) {
if (buttonSendState == HIGH && lastButtonSendState == LOW) {
buttonSendCounter++;
} else {
if (LSMS.ready())
{
LSMS.beginSMS(numSend);
LSMS.print("button Send pressed");
}
LSMS.flush();
}
}
lastButtonSendState = buttonSendState;
//###########################################################################################
I know the button is wired correctly, if I send a SMS to it will trigger a auto-reply with the buttonSendCounter++ content so if I press the button the variable stored number adds up counting the presses.
How do I send a SMS when that button is pressed ???