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

main.cpp

Committer:
bertgereels
Date:
2018-03-19
Revision:
2:6bfe732ba6bc
Parent:
1:b5c534165dfe
Child:
3:538e17979246

File content as of revision 2:6bfe732ba6bc:

#include "mbed.h"
#include "lcd.h"
#include "buzzer_music.h"
#include "rgb.h"
#include "potentiometer.h"
#include "temperature.h"
#include "slave.h"
#include "master.h"
#include "selection.h"
   
using namespace ProjectOne;
    
BusIn joy(p14); //enkel verticaal

int main() {
    BuzzerMusic buzzerMusic;
    Temperature temperatureReader;
    Potentiometer potentiometerReader;
    RGB rgbLed;
    LCD lcdApplicationBoard;
    Selection selection;
    
    string mode;
    int id;
    
    mode = selection.determineMode();
    printf("The mode you selected: '%s'\r\n", mode.c_str());

    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();
        }
    }
}