asdf

Dependencies:   NokiaLCD XMIT_IR mbed

Fork of 4180_mP_WirelessPong_revC by Curtis Mulady

main.cpp

Committer:
cmulady
Date:
2012-10-04
Revision:
1:9ba884d85ac6
Parent:
0:c8ddcaa575ba
Child:
3:8e492eacd346

File content as of revision 1:9ba884d85ac6:

#include "mbed.h"
#include "rtos.h"
#include "NokiaLCD.h"
#include "XMIT_IR.h"

#define FPS 5


DigitalOut led1(LED1);
DigitalOut led2(LED2);
NokiaLCD lcd(p5, p7, p8, p9, NokiaLCD::LCD6610); // mosi, sclk, cs, rst, type
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);

    Thread thread_blinkalive(BlinkAlive);
    Thread thread_updatelcd(UpdateLCD);



    while(1) {
        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);
    }
}