asdf
Dependencies: NokiaLCD XMIT_IR mbed
Fork of 4180_mP_WirelessPong_revC by
Diff: main.cpp
- Revision:
- 1:9ba884d85ac6
- Parent:
- 0:c8ddcaa575ba
- Child:
- 3:8e492eacd346
--- a/main.cpp Thu Oct 04 13:12:12 2012 +0000 +++ b/main.cpp Thu Oct 04 13:58:09 2012 +0000 @@ -1,23 +1,63 @@ #include "mbed.h" #include "rtos.h" #include "NokiaLCD.h" +#include "XMIT_IR.h" -DigitalOut myled(LED1); +#define FPS 5 + + +DigitalOut led1(LED1); +DigitalOut led2(LED2); NokiaLCD lcd(p5, p7, p8, p9, NokiaLCD::LCD6610); // mosi, sclk, cs, rst, type -int main() { +Serial device(p13, p14); // tx, rx +PwmOut IRLED(p21); + +char buffer[32]; + + +void BlinkAlive(void const* arguments); +void UpdateLCD(void const* arguments); + + +int main() +{ lcd.background(0x000000); - lcd.cls(); - lcd.locate(0,1); - lcd.printf("Debug:"); - - - - + + Thread thread_blinkalive(BlinkAlive); + Thread thread_updatelcd(UpdateLCD); + + + while(1) { - myled = 1; - wait(0.2); - myled = 0; - wait(0.2); + thread_updatelcd.signal_set(0x1); + Thread::wait(1000/FPS); + } } + +void UpdateLCD(void const* arguments) +{ + while(true) { + led2 = 1; + lcd.locate(0,1); + lcd.printf("Debug:"); + + lcd.locate(0,3); + time_t seconds = time(NULL); + strftime(buffer, 32, "%I:%M:%S %p\n", localtime(&seconds)); + lcd.printf("%s", buffer); + + //End - Sleep thread + led2 = 0; + Thread::signal_wait(0x1); + } +} + +void BlinkAlive(void const* arguments) +{ + while(true) { + led1 = !led1; + Thread::wait(500); + } +} \ No newline at end of file