Part One of my Project Course. Implementation of simple I/O and a custom defined protocol over UDP/IP.
Dependencies: C12832 LM75B mbed EthernetInterface mbed-rtos
Diff: main.cpp
- Revision:
- 1:b5c534165dfe
- Parent:
- 0:88d3b9015f7c
- Child:
- 2:6bfe732ba6bc
--- a/main.cpp Mon Feb 26 11:25:59 2018 +0000 +++ b/main.cpp Wed Mar 14 07:59:21 2018 +0000 @@ -4,8 +4,10 @@ #include "rgb.h" #include "potentiometer.h" #include "temperature.h" +#include "slave.h" +#include "command.h" #include "master.h" -#include "command.h" +#include "selection.h" using namespace ProjectOne; @@ -17,20 +19,29 @@ Potentiometer potentiometerReader; RGB rgbLed; LCD lcdApplicationBoard; + Selection selection; - if(joy == 1.0){ //ingedrukt? - //slave werking - Slave slave; - slave.handleIncomingFrame(); - }else{ - //master werking - Master master; - master.handlePcData(); + string mode; + int id; + + mode = selection.determineMode(); + printf("The mode you selected: '%s'\r\n", mode); + + id = selection.determineId(); + printf("The id you selected is '%d'\r\n", id); + + if(mode == "slave"){ + Slave slave(id, &temperatureReader,&potentiometerReader,&lcdApplicationBoard,&rgbLed,&buzzerMusic); + while(true){ + slave.handleIncomingFrame(); + } } - - - - + if(mode == "master"){ + Master master(id); + while(true){ + master.handlePcData(); + } + } }