Group 3_ESE519 / Mbed 2 deprecated lab5-remote

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
mfrede
Date:
Tue Nov 10 21:12:58 2015 +0000
Parent:
1:019a3be50b96
Child:
3:1b37d57a4e41
Commit message:
add packet file

Changed in this revision

packet.h Show annotated file Show diff for this revision Revisions of this file
remote.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/packet.h	Tue Nov 10 21:12:58 2015 +0000
@@ -0,0 +1,30 @@
+#ifndef LAB5PACKET
+#define LAB5PACKET
+
+
+class packet
+{
+    #define HELLO_TYPE 1
+    #define ROUTE_REQ_TYPE 2
+    #define ROUTE_ACK_TYPE 3
+    #define DATA_TYPE 4
+    public:
+    packet(unsigned short from, unsigned short to, unsigned short TYPE, float data1, float data2) {
+        TTL = 4;
+        from = from;
+        to = to;
+        TYPE = TYPE;
+        data1 = data1;
+        data2 = data2;
+    };
+    
+    unsigned short from;
+    unsigned short to;
+    unsigned short TTL;
+    unsigned short TYPE;
+    float data1;
+    float data2;
+    
+};
+
+#endif
\ No newline at end of file
--- a/remote.cpp	Tue Nov 10 20:42:06 2015 +0000
+++ b/remote.cpp	Tue Nov 10 21:12:58 2015 +0000
@@ -1,6 +1,7 @@
 #include "mbed.h"
 #include "MRF24J40.h"
 #include <string>
+#include "packet.h"
 
 // RF tranceiver to link with handheld.
 MRF24J40 mrf(p11, p12, p13, p14, p21);