pyrocommander

Dependencies:   Fonts LCD_DISCO_F746NG TS_DISCO_F746NG debug mbed

main.cpp

Committer:
rondekoster
Date:
2016-03-12
Revision:
0:9950b0e13bf3
Child:
1:e46a729c44db

File content as of revision 0:9950b0e13bf3:

#include "mbed.h"
#include "LCD_DISCO_F746NG.h"
//#include "stm32746g_discovery_lcd.h"
//#include "fonts.h"


//LCD_DISCO_F746NG lcd;
DigitalOut led1(LED1);
#define FramesPerSecond 25
char textBuf[12];
int h = 0;
int m = 0;
int s = 0;
int f = 0;
unsigned long FRAMES_IN_HOUR = 3600 * FramesPerSecond;
unsigned long FRAMES_IN_MINUTE = 60 * FramesPerSecond;

int main()
{
    led1 = 1;
    unsigned long x = 0;
//    lcd.SetBackColor(LCD_COLOR_BLACK);
//    lcd.SetTextColor(LCD_COLOR_WHITE);
//    lcd.DrawRect(1, 1, 475, 270);
//    lcd.DisplayStringAt(0, LINE(1), (uint8_t *)"www.Pyrocommander.com", CENTER_MODE);
//    lcd.SetBackColor(LCD_COLOR_RED);
//    lcd.SetTextColor(LCD_COLOR_YELLOW);
    while(1) {
        //wait(0.040);
        wait_ms (40);
        x++;
        h = (int) (x / FRAMES_IN_HOUR);
        m = (int) ((x % FRAMES_IN_HOUR) / FRAMES_IN_MINUTE);
        s = (int) (((x % FRAMES_IN_HOUR) % FRAMES_IN_MINUTE) / FramesPerSecond);
        f = (((x % FRAMES_IN_HOUR) % FRAMES_IN_MINUTE) % FramesPerSecond);
        sprintf(textBuf,"%02d:%02d:%02d:%02d", h,m,s,f);
//        lcd.DisplayStringAt(50, LINE(5), (uint8_t *)textBuf, LEFT_MODE);
        led1 = !led1;
    }
}