A sunrise alarm clock controlled through serial designed to run on a LPC 1768 and is currently being modified to run on a Nucleo board
Revision 0:ea21a4715fed, committed 2015-08-05
- Comitter:
- propellerhead
- Date:
- Wed Aug 05 13:24:21 2015 +0000
- Child:
- 1:dcd847fa6def
- Commit message:
- PWM works, output from the RTC
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Aug 05 13:24:21 2015 +0000 @@ -0,0 +1,48 @@ +#include "mbed.h" + +PwmOut reds(p21); +PwmOut greens(p22); +PwmOut yellows(p23); +PwmOut blues(p24); + +Serial pc(USBTX, USBRX); + +void Rx_interrupt(void); + +int main(){ + pc.baud(9600); + reds.period_ms(1); + greens.period_ms(1); + yellows.period_ms(1); + blues.period_ms(1); + + reds.pulsewidth_us(500); + greens.pulsewidth_us(500); + yellows.pulsewidth_us(500); + blues.pulsewidth_us(500); + + pc.attach(&Rx_interrupt, Serial::RxIrq); + + set_time(1256729737); // Set RTC time to Wed, 28 Oct 2009 11:35:37 + + while(1) { + time_t seconds = time(NULL); + seconds. + + printf("Time as seconds since January 1, 1970 = %d\r\n", seconds); + + printf("Time as a basic string = %s\r\n", ctime(&seconds)); + + char buffer[32]; + strftime(buffer, 32, "%I:%M %p\r\n", localtime(&seconds)); + printf("Time as a custom formatted string = %s\r\n", buffer); + + wait(1); + } + + return 0; +} + +void Rx_interrupt(){ + +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Aug 05 13:24:21 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/cbbeb26dbd92 \ No newline at end of file