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
main.cpp@1:92a2a5ef65a8, 2015-10-29 (annotated)
- Committer:
- dreamselec
- Date:
- Thu Oct 29 15:19:24 2015 +0000
- Revision:
- 1:92a2a5ef65a8
- Parent:
- 0:fe5cb0a8fc5a
- Child:
- 2:7a55cb10259f
Initial commit imported required libs.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dreamselec | 0:fe5cb0a8fc5a | 1 | #include "mbed.h" |
dreamselec | 0:fe5cb0a8fc5a | 2 | #include "WattBob_TextLCD.h" |
dreamselec | 0:fe5cb0a8fc5a | 3 | #include "TCS3472_I2C.h" |
dreamselec | 0:fe5cb0a8fc5a | 4 | #include "MCP23017.h" |
dreamselec | 0:fe5cb0a8fc5a | 5 | #include <string> |
dreamselec | 1:92a2a5ef65a8 | 6 | #include <time.h> |
dreamselec | 0:fe5cb0a8fc5a | 7 | |
dreamselec | 0:fe5cb0a8fc5a | 8 | #define BACKLIGHT_ON(INTERFACE) INTERFACE->write_bit(1, 4); |
dreamselec | 0:fe5cb0a8fc5a | 9 | #define BACKLIGHT_OFF(INTERFACE) INTERFACE->write_bit(0, 4); |
dreamselec | 0:fe5cb0a8fc5a | 10 | |
dreamselec | 0:fe5cb0a8fc5a | 11 | #define PRINT_LCD(TEXT) lcd->printf(TEXT); |
dreamselec | 0:fe5cb0a8fc5a | 12 | #define CLEAR_LCD() lcd->cls(); |
dreamselec | 0:fe5cb0a8fc5a | 13 | #define LCDFL() lcd->locate(0,0); |
dreamselec | 0:fe5cb0a8fc5a | 14 | #define LCDSL() lcd->locate(1,0); |
dreamselec | 0:fe5cb0a8fc5a | 15 | #define CLEAR_LEDS() i2cport->write_bit(0, 12); i2cport->write_bit(0, 13); i2cport->write_bit(0, 14); i2cport->write_bit(0, 15); |
dreamselec | 0:fe5cb0a8fc5a | 16 | |
dreamselec | 0:fe5cb0a8fc5a | 17 | DigitalOut myled(LED1); |
dreamselec | 0:fe5cb0a8fc5a | 18 | |
dreamselec | 0:fe5cb0a8fc5a | 19 | MCP23017 *i2cport; |
dreamselec | 0:fe5cb0a8fc5a | 20 | WattBob_TextLCD *lcd; |
dreamselec | 0:fe5cb0a8fc5a | 21 | |
dreamselec | 1:92a2a5ef65a8 | 22 | TCS3472_I2C rgb_sensor(p28, p27); |
dreamselec | 1:92a2a5ef65a8 | 23 | Serial pc(USBTX, USBRX); |
dreamselec | 0:fe5cb0a8fc5a | 24 | |
dreamselec | 0:fe5cb0a8fc5a | 25 | int main(){ |
dreamselec | 0:fe5cb0a8fc5a | 26 | i2cport = new MCP23017(p9, p10, 0x40); |
dreamselec | 0:fe5cb0a8fc5a | 27 | lcd = new WattBob_TextLCD(i2cport); |
dreamselec | 0:fe5cb0a8fc5a | 28 | BACKLIGHT_ON(i2cport); |
dreamselec | 0:fe5cb0a8fc5a | 29 | int rgb_results[4]; |
dreamselec | 1:92a2a5ef65a8 | 30 | pc.baud(19200); |
dreamselec | 1:92a2a5ef65a8 | 31 | srand((unsigned)time(NULL)); |
dreamselec | 0:fe5cb0a8fc5a | 32 | |
dreamselec | 0:fe5cb0a8fc5a | 33 | } |