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: C12832 EthernetInterface mbed-rtos mbed ConfigFile
Diff: main.cpp
- Revision:
- 3:254a2671a8e3
- Parent:
- 2:a8eebf64cd3e
- Child:
- 4:339a85b66476
--- a/main.cpp Thu Mar 05 15:32:22 2015 +0000 +++ b/main.cpp Fri Mar 06 08:20:56 2015 +0000 @@ -1,27 +1,17 @@ #include "mbed.h" -#include "EthernetInterface.h" #include "C12832.h" #include "Log.h" #include "TcpDaemon.h" +#include "StatusIndicator.h" -#define MAX_BACKLOG 1 #define TCP_SERVER_PORT 6666 #define LCD_LINE_HEIGHT 12 -#define DELAY_INDICATION 0 - -#define STR_FAIL "FAIL" -#define STR_OK "OK" -#define STR_CLEAR "CLEAR" Serial pc(USBTX,USBRX); DigitalOut error_led(LED1); C12832 lcd(p5, p7, p6, p8, p11); -PwmOut rOut (p23); -PwmOut gOut (p24); -PwmOut bOut (p25); - using namespace MachineVision; void setLcdServerInfo(char * ip) { @@ -32,45 +22,13 @@ lcd.printf("Port: %d", TCP_SERVER_PORT); } -void setRGB(int r, int g, int b) { - rOut = r; - gOut = g; - bOut = b; -} - -void clearRGB(void) { - setRGB(255, 255, 255); -} - -void initRgb(void) { - rOut.period(0.001); // set pwm period - gOut.period(0.001); // set pwm period - bOut.period(0.001); // set pwm period - - setRGB(255, 255, 255); -} - -void indicateOk(void) { - setRGB(255, 0, 255); -} - -void indicateFail(void) { - setRGB(0, 255, 255); -} - int main (void) { - // Init RGB led - initRgb(); + StatusIndicator status_indicator(p23, p24, p25); +// status_indicator.setStatus(OK); pc.baud(115200); - - // Status check - for (int i = 0; i < 4; i++) { - indicateOk(); - indicateFail(); - } - clearRGB(); - + + // Setup ethernet interface EthernetInterface eth; Log::v("Requesting IP address from DHCP\r\n"); eth.init(); //Use DHCP @@ -85,7 +43,7 @@ setLcdServerInfo(eth.getIPAddress()); // Start the daemon - TcpDaemon daemon(TCP_SERVER_PORT, LED2); + TcpDaemon daemon(TCP_SERVER_PORT, LED2, LED3); Log::v("TCP daemon listening @ TCP_SERVER_PORT = %d\r\n", TCP_SERVER_PORT); daemon.startListening(); }