Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<SoftwareSerial.h>
- #include "sms.h"
- SMSGSM sms;
- boolean started=false;
- char posicao_sms;
- char texto_sms[10];
- char num_fone[20];
- char num_cadastrado[] = "+557791991885";
- int i;
- int led1;
- int led2;
- String xpto(texto_sms);
- //------------------------------------------------
- void setup()
- {
- pinMode(led1, OUTPUT);
- pinMode(led2, OUTPUT);
- Serial.begin(9600);
- Serial.println("Testando Sistema....");
- if (gsm.begin(4800)){
- Serial.println("\nSistema Pronto!");
- started=true;}
- else
- Serial.println("\nSistema Inativo!");
- }
- //------------------------------------------------
- void loop()
- {
- if(started)
- {
- for(i=1;i<=20;i++)
- {
- sms.DeleteSMS(i);
- }
- posicao_sms=sms.IsSMSPresent(SMS_UNREAD);
- if (posicao_sms)
- {
- Serial.print("Posicao do SMS:");
- Serial.println(posicao_sms,DEC);
- sms.GetSMS(posicao_sms, num_fone, texto_sms, 10);
- Serial.println(num_fone);
- // Serial.println(texto_sms);
- Serial.println(xpto);
- }
- /* if (texto_sms == 'v1on')
- digitalWrite(led1, HIGH);
- if (texto_sms == 'v1off')
- digitalWrite(led1, LOW);
- if (texto_sms == 'v2on')
- digitalWrite(led2, HIGH);
- if (texto_sms == 'v2off')
- digitalWrite(led2, LOW);*/
- // }
- // else{
- Serial.println("Sem novos SMS's. AGUARDANDO!");
- //}
- // }
- delay(500);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement