fork of seeed studio 4-digit display for st nucleo board
Dependencies: Data_Clock_Pair Seeed_Chainable_LED Seeed_Four_Digit_Disp Seeed_IR_Temp_Sensor Seeed_Led_Bar
Fork of Seeed_Grove_4_Digit_Display_Clock by
main.cpp
- Committer:
- tulanthoar
- Date:
- 2017-04-10
- Revision:
- 2:1ae739c15893
- Parent:
- 1:f45925081128
- Child:
- 3:c4427ce4d171
File content as of revision 2:1ae739c15893:
#include "mbed.h" #include "DigitDisplay.h" DigitDisplay display(PE_11, PE_9); // 4-Digit Display connected to UART Grove connector DigitalOut led(LED1); Ticker ticker; volatile uint8_t second = 0; volatile uint8_t minute = 0; volatile uint8_t hour = 12; volatile bool colon_enable = false; void tick() { colon_enable = !colon_enable; display.setColon(colon_enable); if (colon_enable) { second++; if (second >= 60) { second = 0; minute++; if (minute >= 60) { minute = 0; hour++; if (hour >= 24) { hour = 0; } } display.write(hour * 100 + minute); } } } int main() { display.write(hour * 100 + minute); ticker.attach(tick, 0.5); while(1) { led = !led; wait(0.5); } }