Difference between revisions of "Rolpoort bediening"
Line 2: | Line 2: | ||
|Members=Da Syntax | |Members=Da Syntax | ||
|Description=Controll the gate using your cellphone | |Description=Controll the gate using your cellphone | ||
− | }} | + | }} Setup done AT*ECAM=1 |
− | Setup done AT*ECAM=1 | ||
OK | OK | ||
Line 19: | Line 18: | ||
---- | ---- | ||
− | Code om PDU packed bitsequence om te zetten naar "Human readable" code | + | Code om PDU packed bitsequence om te zetten naar "Human readable" code |
[http://code.google.com/p/smspdu-cpp/source/browse/trunk/smstools3/pdu.c?r=2 Hiero] | [http://code.google.com/p/smspdu-cpp/source/browse/trunk/smstools3/pdu.c?r=2 Hiero] | ||
Line 29: | Line 28: | ||
---- | ---- | ||
− | <br> | + | <br> |
+ | |||
+ | #include <SoftwareSerial.h> | ||
+ | |||
+ | SoftwareSerial mobiel(9, 10); // RX, TX | ||
+ | |||
+ | unsigned long CID_Current;<br>unsigned long CID_Joshua = 642828732;<br>unsigned long CID_Michel = 655986620; | ||
+ | |||
+ | byte myChar;<br>int mobMSGi = 0;<br>char mobMSG[128];<br>char bingo[] = "*ECAV: 1,6,1,,,"; | ||
− | + | boolean compare(char stringone[], char stringtwo[]); | |
− | + | void setup() <br>{<br> pinMode(7, OUTPUT);<br> <br> Serial.begin(9600);<br> <br> mobiel.begin(9600);<br> delay(500);<br> <br> mobiel.println("AT*ECAM=1");<br> Serial.println("Setup done");<br>} | |
− | + | void loop()<br>{<br> if (mobiel.available()) {<br> mobMSG[mobMSGi] = mobiel.read();<br> Serial.write(mobMSG[mobMSGi]);<br> if ( mobMSG[mobMSGi] == '\n' ) {<br> if ( compare(mobMSG, bingo) == true ) {<br> Serial.println("JACKPOT!!!!!!!!!!!");<br> CID_Current = 0;<br> for (int i = sizeof(bingo)+2; mobMSG[i+1] != '"'; i++) {<br> CID_Current *= 10;<br> CID_Current += mobMSG[i+1] - 48;<br> }<br> Serial.print("Telefoonnummer: ");<br> Serial.print(CID_Current);<br> Serial.println("");<br> switch (CID_Current) {<br> case 642828732:<br> Serial.println("Joshua belt");<br> break;<br> case 655986620:<br> Serial.println("Michel belt");<br> break;<br> default:<br> Serial.println("Onbekend belt");<br> }<br> }<br> mobMSGi = 0;<br> }<br> mobMSGi++;<br> }<br> <br> if (Serial.available())<br> mobiel.write(Serial.read());<br>} | |
− | + | boolean compare(char stringone[], char stringtwo[]) {<br> boolean check = true; | |
− | + | for(int i = 0; i < 15; i++) {<br> if (stringone[i+1] != stringtwo[i]) {<br> check = false;<br> }<br> } | |
− | + | return check;<br>}<br> | |
− | + | <br> | |
− | + | ---- | |
− | + | AT<br>OK<br>AT+CMGF=1<br>OK<br>AT+CMGL="ALL"<br>+CMGL: 1,"REC READ","+85291234567",,"06/11/11,00:30:29+32"<br>Hello, welcome to our SMS tutorial.<br>+CMGL: 2,"REC READ","+85291234567",,"06/11/11,00:32:20+32"<br>A simple demo of SMS text messaging. | |
− | + | OK<br> |
Revision as of 03:36, 14 October 2012
Project: Rolpoort bediening | |
---|---|
Featured: | |
State | |
Members | Da Syntax |
GitHub | No GitHub project defined. Add your project here. |
Description | Controll the gate using your cellphone |
Picture | |
No project picture! Fill in form Picture or Upload a jpeg here |
Setup done AT*ECAM=1
OK
RING
- ECAV: 1,6,1,,,"31642828732",145
RING
- ECAV: 1,0,1,08,222
Code om PDU packed bitsequence om te zetten naar "Human readable" code
https://ackspace.nl/wiki/File:Sketchbook.tar
- include <SoftwareSerial.h>
SoftwareSerial mobiel(9, 10); // RX, TX
unsigned long CID_Current;
unsigned long CID_Joshua = 642828732;
unsigned long CID_Michel = 655986620;
byte myChar;
int mobMSGi = 0;
char mobMSG[128];
char bingo[] = "*ECAV: 1,6,1,,,";
boolean compare(char stringone[], char stringtwo[]);
void setup()
{
pinMode(7, OUTPUT);
Serial.begin(9600);
mobiel.begin(9600);
delay(500);
mobiel.println("AT*ECAM=1");
Serial.println("Setup done");
}
void loop()
{
if (mobiel.available()) {
mobMSG[mobMSGi] = mobiel.read();
Serial.write(mobMSG[mobMSGi]);
if ( mobMSG[mobMSGi] == '\n' ) {
if ( compare(mobMSG, bingo) == true ) {
Serial.println("JACKPOT!!!!!!!!!!!");
CID_Current = 0;
for (int i = sizeof(bingo)+2; mobMSG[i+1] != '"'; i++) {
CID_Current *= 10;
CID_Current += mobMSG[i+1] - 48;
}
Serial.print("Telefoonnummer: ");
Serial.print(CID_Current);
Serial.println("");
switch (CID_Current) {
case 642828732:
Serial.println("Joshua belt");
break;
case 655986620:
Serial.println("Michel belt");
break;
default:
Serial.println("Onbekend belt");
}
}
mobMSGi = 0;
}
mobMSGi++;
}
if (Serial.available())
mobiel.write(Serial.read());
}
boolean compare(char stringone[], char stringtwo[]) {
boolean check = true;
for(int i = 0; i < 15; i++) {
if (stringone[i+1] != stringtwo[i]) {
check = false;
}
}
return check;
}
AT
OK
AT+CMGF=1
OK
AT+CMGL="ALL"
+CMGL: 1,"REC READ","+85291234567",,"06/11/11,00:30:29+32"
Hello, welcome to our SMS tutorial.
+CMGL: 2,"REC READ","+85291234567",,"06/11/11,00:32:20+32"
A simple demo of SMS text messaging.
OK