Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EthernetInterface LM75B mbed-rtos mbed
Diff: Setup.cpp
- Revision:
- 0:29eeb74e55c6
- Child:
- 1:db9b9bec0133
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Setup.cpp Tue Mar 13 11:10:03 2018 +0000 @@ -0,0 +1,90 @@ +#include "setup.h" +#include "lcdcontrol.h" + +BusIn joy(p15,p12,p13,p16); +DigitalIn fire(p14); + +LcdControl lcd; + + +Setup::Setup() + :tempID("100"),tester() +{ + //Constructor +} + +int Setup::chooseID() +{ + int setID = 100; + lcd.lcdReset(); + lcd.printID(setID); + while(fire==0) + { + if(joy.read() == 1) + { + printf("test"); + lcd.lcdReset(); + if(setID == 110){ + setID = 100; + } + else + { + setID++; + } + lcd.printID(setID); + wait(0.3); + } + if(joy.read() == 2) + { + lcd.lcdReset(); + if(setID == 100){ + setID = 110; + } + else + { + setID--; + } + lcd.printID(setID); + wait(0.3); + } + } while(fire != 0){} + return setID; +} + +int Setup::chooseMode() +{ + + lcd.printMode(); + lcd.printSlave(); + while(fire != 0){} + while(fire == 0){ + if(joy.read() == 8) { + if(mode == 1){ + mode=0; + lcd.printMode(); + lcd.printSlave(); + } + } + else if(joy.read() == 4) { + if(mode == 0){ + mode=1; + lcd.printMode(); + lcd.printMaster(); + } + } + } + if(mode == 0) + { + return 0; + } + else + { + return 1; + } +} + +char* Setup::convertToIP(int ID) +{ + sprintf(tempID,"%ld",ID); + return strcat(tester,tempID); +} \ No newline at end of file