Paso 6: Subir el código
Ahora cargar el código para un enlace uno para torneado de la lámpara encendido y apagado + comentarios de voz.
Si usted quiere controlar el volumen y luego editar esta línea "LAudio.setVolume(5);" Rangos de volumen de 1-6 así que edición 5.
Now, Upload the Code to Turn the Lamp on and off with sms + voice Feedback.Code: /* * SMS Control Light + Voice Feedback. * * You should insert a SIM card and the GPRS antenna * Send a "on" or "ON" to lighten the led * Send a "off" or "OFF" to make the led off * This Code also has Audio Feedback. * LED connect to D3Edited by Ayush SharmaOn: 10/29/15 */ #include #include /* * SMS Control Light * * You should insert a SIM car and the GPRS antenna * Send a "on" or "ON" to lighten the led * Send a "off" or "OFF" to make the led off * This Code also Has Voice Feedback. * LED connect to D3 */ #include #include #include char buff[120]; const int pinLed = 3; // led connect to D3 void setup() { Serial.begin(9600); LAudio.begin(); { LAudio.playFile( storageFlash,(char*)"firstassist.mp3"); LAudio.setVolume(5); Serial.println("playing - firstassist.mp3"); } while(!LSMS.ready()) { delay(1000); } Serial.println("GSM OK!!"); } void loop() { char p_num[20]; int len = 0; char dtaget[500]; if(LSMS.available()) // Check if there is new SMS { LSMS.remoteNumber(p_num, 20); // display Number part Serial.println("There is new message."); Serial.print("Number:"); Serial.println(p_num); Serial.print("Content:"); // display Content part while(true) { int v = LSMS.read(); if(v < 0) break; dtaget[len++] = (char)v; Serial.print((char)v); } Serial.println(); LSMS.flush(); // delete message if((dtaget[0] == 'O' && dtaget[1] == 'N') || (dtaget[0] == 'o' && dtaget[1] == 'n')) { digitalWrite(pinLed, HIGH); LAudio.playFile( storageFlash,(char*)"turnedon.mp3"); //Playing LAudio.setVolume(5); Serial.println("playing - turnedon.mp3"); } else if((dtaget[0] == 'O' && dtaget[1] == 'F' && dtaget[2] == 'F') || (dtaget[0] == 'o' && dtaget[1] == 'f' && dtaget[2] == 'f')) { digitalWrite(pinLed, LOW); // lamp off LAudio.playFile( storageFlash,(char*)"turnedoff.mp3"); //Playing LAudio.setVolume(5); Serial.println("playing - turnedoff.mp3"); } } }#include char buff[120]; const int pinLed = 3; // led connect to D3 void setup() { Serial.begin(9600); LAudio.begin(); { LAudio.playFile( storageFlash,(char*)"LS8Mo.wav"); LAudio.setVolume(5); Serial.println("playing - firstassist.mp3"); } while(!LSMS.ready()) { delay(1000); } Serial.println("GSM OK!!"); } void loop() { char p_num[20]; int len = 0; char dtaget[500]; if(LSMS.available()) // Check if there is new SMS { LSMS.remoteNumber(p_num, 20); // display Number part Serial.println("There is new message."); Serial.print("Number:"); Serial.println(p_num); Serial.print("Content:"); // display Content part while(true) { int v = LSMS.read(); if(v < 0) break; dtaget[len++] = (char)v; Serial.print((char)v); } Serial.println(); LSMS.flush(); // delete message if((dtaget[0] == 'O' && dtaget[1] == 'N') || (dtaget[0] == 'o' && dtaget[1] == 'n')) { digitalWrite(pinLed, HIGH); LAudio.playFile( storageFlash,(char*)"turnedon.mp3"); //Playing LAudio.setVolume(5); Serial.println("playing - turnedon.mp3"); } else if((dtaget[0] == 'O' && dtaget[1] == 'F' && dtaget[2] == 'F') || (dtaget[0] == 'o' && dtaget[1] == 'f' && dtaget[2] == 'f')) { digitalWrite(pinLed, LOW); // lamp off LAudio.playFile( storageFlash,(char*)"turnedoff.mp3"); //Playing LAudio.setVolume(5); Serial.println("playing - turnedoff.mp3"); } } }