The transmitter's code for Home Security with RF

Dependencies:   hmac_md5 mbed

Files at this revision

API Documentation at this revision

Comitter:
jsobchuk3
Date:
Mon Dec 08 22:43:22 2014 +0000
Commit message:
ECE 4180 Final

Changed in this revision

hmac_md5.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 47380c5f575d hmac_md5.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hmac_md5.lib	Mon Dec 08 22:43:22 2014 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/igrokhotkov/code/hmac_md5/#83f3dcfa5c8f
diff -r 000000000000 -r 47380c5f575d main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Dec 08 22:43:22 2014 +0000
@@ -0,0 +1,65 @@
+#include "mbed.h"
+#include "hmac_md5.h"
+#include <stdio.h>
+#include <string.h>
+
+DigitalOut myled1(LED1);
+DigitalOut myled2(LED2);
+
+DigitalIn pb(p20);
+Serial rf(p9,p10);
+
+
+int main() {
+    pb.mode(PullUp);
+    // Delay for initial pullup to take effect
+    wait(.01);
+    
+    rf.baud(1200);
+    int old_pb=0;
+    int new_pb;
+    
+    /*const char * key = "Dhruvin";
+    const char * text = "open";
+    char output[26];
+    char output2[3];
+    */
+    
+    int i = 0;
+    /*HMAC_MD5(key, text, output);
+    output2[0] = output[0];
+    output2[1] = output[1];
+    output2[2] = output[2];
+    */
+    char key[4] = "Dhr";
+    for (i = 0; i < 4; i++) {
+        key[i] = (key[i] + 5); 
+    }
+    while (1) {
+        new_pb = pb;
+        if( (new_pb==0) && (old_pb==1) ) {
+            //Send out the real data whenever the button is pressed
+            rf.putc(key[0]);
+            rf.putc(key[1]);
+            rf.putc(key[2]);
+            
+            //HMAC_MD5(output2, text, output2);
+            for (i = 0; i < 4; i++) {
+                key[i] = (key[i] + 5); 
+            }
+            
+        }
+         
+        else {
+            //RF Transmit Code
+            myled1 = 0;
+            //Send 10101010 pattern when idle to keep receivers AGC gain locked to transmitters signal
+            //When receiver loses the signal lock (Around 10-30MS with no data change seen) it starts sending out noise
+            rf.putc(0xAA);
+            myled1 = 0;
+            
+        }
+        old_pb = new_pb; 
+        
+    }
+}
diff -r 000000000000 -r 47380c5f575d mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Dec 08 22:43:22 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/031413cf7a89
\ No newline at end of file