![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
3rd year group project. Electronic and Electrical Engineering. Heriot-Watt University. This is the code for the mbed for the Automatic Little Object Organiser (ALOO).
Dependencies: MCP23017 TCS3472_I2C WattBob_TextLCD mbed
Diff: globals.cpp
- Revision:
- 14:cf2f255b5560
- Parent:
- 11:0fe833f8a1ab
- Child:
- 15:777390eb5afd
--- a/globals.cpp Sat Nov 21 20:24:08 2015 +0000 +++ b/globals.cpp Sun Nov 22 17:53:36 2015 +0000 @@ -34,14 +34,14 @@ void connectToPC(CommandTypeRaw typeRaw) { - pc.printf("pc told to connect\n"); connectedToPC = true; + pc.printf("MBED connected to PC\n"); } void disconnectToPC(CommandTypeRaw typeRaw) { - pc.printf("pc told to disconnect\n"); connectedToPC = false; + pc.printf("MBED disconnected from PC\n"); } void hazBlock(CommandTypeRaw typeRaw) @@ -95,7 +95,7 @@ pc.printf("getting current block readings\n"); } -void setIntegrationTime(int integrationTime) +void setIntegrationTime(float integrationTime) { rgbSensor.setIntegrationTime(integrationTime); pc.printf("setting i-time to %i.\n", integrationTime); @@ -129,8 +129,14 @@ pc.printf("getting port info.\n"); } -void setPortBaudRate(int baudRate) +void setPortBaudRate(int baudRate=kDefaultBaudRate) { - pc.printf("setting port baudrate to: %i\n", baudRate); + pc.baud(baudRate); + pc.printf("Setting port Baud Rate to: %i\n", baudRate); } +void setPortParity(int parity){ + SerialBase::Parity _parity = static_cast<SerialBase::Parity>(parity); + pc.format(8, _parity, 1); + pc.printf("Setting port parity to: %i\n", parity); +}