![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
dd
Dependencies: xtoff2 RF24Network mbed
Fork of xtoff3 by
Diff: Ontvanger.cpp
- Revision:
- 13:f54dfb74247e
- Parent:
- 11:77018fac195e
- Child:
- 15:f8aad6d1db68
diff -r a3dd2ebf8f93 -r f54dfb74247e Ontvanger.cpp --- a/Ontvanger.cpp Mon Mar 12 10:56:50 2018 +0000 +++ b/Ontvanger.cpp Wed Mar 21 16:22:28 2018 +0000 @@ -1,5 +1,6 @@ #include "Ontvanger.h" +Serial pc2(USBTX, USBRX); RF24 radio(spi_MOSI, spi_MISO, spi_SCK, nrf_CE, nrf_CSN ); RF24Network network(radio); @@ -29,6 +30,10 @@ { payload_t payload_rx; network.read(header_rx,&payload_rx,sizeof(payload_rx)); + + if(payload_rx.messageAvailable == true) + printMessage(payload_rx.messageIndex); + return payload_rx; } @@ -51,4 +56,33 @@ return radio.testRPD(); } +void Ontvanger::printMessage(char index){ + switch (index) { + case '1': + pc2.printf("Message: Initializing...\n\r"); + break; + case '2': + pc2.printf("Message: Taring...\n\r"); + break; + case '3': + pc2.printf("Message: Error: Tare first\n\r"); + break; + case '4': + pc2.printf("Message: Tare completed\n\r"); + break; + case '5': + pc2.printf("Message: Error: Tare value to low... Retry\n\r"); + break; + case '6': + pc2.printf("Message: Waiting on the right position...\n\r"); + break; + case '7': + pc2.printf("Message: Wait 5 Seconds on POSITION...\n\r"); + break; + case '8': + pc2.printf("Message: ERROR: Not on position\n\r"); + break; +} + } +