transmitter

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
JonathanCaes
Date:
Mon May 18 13:41:04 2015 +0000
Commit message:
Transmitter

Changed in this revision

mbed.bld Show annotated file Show diff for this revision Revisions of this file
transmit.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon May 18 13:41:04 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/433970e64889
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/transmit.cpp	Mon May 18 13:41:04 2015 +0000
@@ -0,0 +1,48 @@
+//Caes Jonathan & Bram Van Reusel
+//Wireless
+//Library's declareren
+#include "mbed.h"
+
+//seriële poorten declareren
+Serial pc(USBTX,USBRX);
+Serial uart(p9, p10); //tx, rx
+
+//Pinaansluiting declareren
+DigitalOut myled1(LED1);
+DigitalOut PDN(p26);
+AnalogIn LDR(p20);
+
+//variabelen om sensoren in te lezen
+float ldr = 0;
+
+//variabelen om te sturen
+int sturen;
+char adres;
+char data;
+char crc;
+
+//main programma
+int main()
+{
+    //instellingen voor de zender
+    PDN = 1;
+    uart.baud(1200); //snelheid van communiceren
+    //instelling voor communicatie met pc
+    pc.baud(9600);
+    
+    //begin programma
+    while(1)
+    {
+        adres = 74;
+        ldr = LDR;
+        data = ldr * 255;
+        crc = (adres xor data);
+        
+        myled1 = 1;
+        uart.printf("%c%c%c", adres, data, crc);
+        pc.printf("adres: %c\n", adres);
+        pc.printf("data: %c\n", data);
+        pc.printf("crc: %c\n", crc);        
+        myled1 = 0;
+    }   
+}