![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
dd
Dependencies: xtoff2 RF24Network mbed
Fork of xtoff3 by
main.cpp@4:7ebc3b421306, 2018-02-12 (annotated)
- Committer:
- pietor
- Date:
- Mon Feb 12 16:50:45 2018 +0000
- Revision:
- 4:7ebc3b421306
- Parent:
- 3:e9c4d66da50c
- Child:
- 6:6a82110ff393
Ontvanger;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pietor | 4:7ebc3b421306 | 1 | /** |
pietor | 4:7ebc3b421306 | 2 | Main.cpp |
pietor | 4:7ebc3b421306 | 3 | Purpose: main class |
pietor | 4:7ebc3b421306 | 4 | |
pietor | 4:7ebc3b421306 | 5 | @author Pieter Berteloot |
pietor | 4:7ebc3b421306 | 6 | */ |
akashvibhute | 0:3982c0e9eda1 | 7 | #include "mbed.h" |
pietor | 4:7ebc3b421306 | 8 | #include "Ontvanger.h" |
pietor | 4:7ebc3b421306 | 9 | |
pietor | 4:7ebc3b421306 | 10 | DigitalOut myled1(LED1); |
pietor | 4:7ebc3b421306 | 11 | DigitalOut myled2(LED2); |
pietor | 4:7ebc3b421306 | 12 | DigitalOut myled3(LED3); |
pietor | 4:7ebc3b421306 | 13 | DigitalOut myled4(LED4); |
akashvibhute | 0:3982c0e9eda1 | 14 | |
akashvibhute | 0:3982c0e9eda1 | 15 | Serial pc(USBTX, USBRX); |
akashvibhute | 0:3982c0e9eda1 | 16 | |
pietor | 4:7ebc3b421306 | 17 | Ontvanger receive; |
akashvibhute | 0:3982c0e9eda1 | 18 | |
akashvibhute | 2:608cf8c5c55e | 19 | int main() |
akashvibhute | 0:3982c0e9eda1 | 20 | { |
pietor | 4:7ebc3b421306 | 21 | pc.baud(9600); |
pietor | 4:7ebc3b421306 | 22 | pc.printf("Ontvangger: \r\n"); |
pietor | 4:7ebc3b421306 | 23 | while(1) { |
pietor | 4:7ebc3b421306 | 24 | receive.update(); |
pietor | 4:7ebc3b421306 | 25 | while (receive.available()) { |
pietor | 4:7ebc3b421306 | 26 | payload_t payload; |
pietor | 4:7ebc3b421306 | 27 | payload = receive.read(); |
pietor | 4:7ebc3b421306 | 28 | pc.printf("Received packet -- Reed: %d --- %d mg \r\n",payload.reedsensor,payload.milligram); |
pietor | 4:7ebc3b421306 | 29 | myled1 = myled2 = myled3 = myled4= payload.reedsensor; |
akashvibhute | 0:3982c0e9eda1 | 30 | } |
pietor | 4:7ebc3b421306 | 31 | myled1 = myled2 = myled3 = myled4= 0; |
akashvibhute | 0:3982c0e9eda1 | 32 | } |
akashvibhute | 0:3982c0e9eda1 | 33 | } |