Source of demand
1. My son finished the year 6 years old, like to play fireworks, but the courage is small, so I am responsible for ignition, from the year before 26 to the beginning of eight, every night to give his son point firecrackers ah point firecrackers.
2. The new year to open the door gun and opened the gun, Lunar New Year early morning also to help mom point firecrackers, said the whole string of small firecrackers also fried too fast, every time did not run a few steps on the open, brother also bad heart ah.
Design:
According to demand, we need a long-distance ignition of the lighter, on the Taobao on a circle, found a USB lighter, renew the appliance, plus a SIM900 arduino expansion board, come back simple succession, it is.
Code:
#include <SoftwareSerial.h>#include<String.h>softwareserial GPRS (7,8); String CurrentLine="";//string to hold the text from serverString triggerno="13616761237"; String Mobile=""; Boolean Readingno=false;LongLasttriggertime=0; Boolean fireing=false;intLed=4;voidSetup () {Gprs.begin (19200);//The GPRS baud rateSerial.begin (19200);//The GPRS baud ratePinmode (9, OUTPUT); Pinmode (Led,output); Digitalwrite (Led,low); Delay ( -); Powerupordown ();}voidLoop () {if(fireing) {if(Millis ()-Lasttriggertime >= A* +) {serial.println ("Stop fire!"); Digitalwrite (Led,low); Fireing=false; }Else{ return; } } while(Gprs.available ()) {CharInchar=Gprs.read (); CurrentLine+=Inchar; if(inchar=='\ n') currentline=""; if(Currentline.endswith ("+clip: \ "") ) {Readingno=true; Mobile=""; } if(Readingno) {if(Inchar! =','){ if(Inchar! ='"') mobile+=Inchar; }Else{Readingno=false; SERIAL.PRINTLN (mobile); if(mobile==Triggerno) {Lasttriggertime=Millis (); Serial.println ("fire!!"); Fireing=true; CurrentLine=""; Mobile=""; Delay ( +); Digitalwrite (Led,high); Delay (4000); Gprs.println ("ATH"); while(Gprs.available ()) {gprs.read (); } } } } } }voidPowerupordown () {Digitalwrite (9, low); Delay ( +); Digitalwrite (9, high); Delay ( -); Digitalwrite (9, low); Delay ( the);}
(Standby state and trigger State):
Arduino UNO R3 + SIM900 + USB lighter for phone triggering