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 2:223c142956c6, committed 2015-08-06
- Comitter:
- propellerhead
- Date:
- Thu Aug 06 17:22:57 2015 +0000
- Parent:
- 1:dcd847fa6def
- Child:
- 3:6f4ece2ea257
- Child:
- 4:f2f25ca84b32
- Commit message:
- Working on lpc1768
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Aug 05 19:28:12 2015 +0000 +++ b/main.cpp Thu Aug 06 17:22:57 2015 +0000 @@ -1,10 +1,10 @@ #include "mbed.h" #include "RTC.h" -PwmOut reds(p24); -PwmOut greens(p22); -PwmOut yellows(p23); -PwmOut blues(p21); +PwmOut reds(D7); +PwmOut greens(D6); +PwmOut yellows(D5); +PwmOut blues(D4); Serial pc(USBTX, USBRX); @@ -39,6 +39,7 @@ int main() { + pc.baud(9600); reds.period_ms(1); greens.period_ms(1); @@ -55,7 +56,7 @@ set_time(1256729737); // Set RTC time to Wed, 28 Oct 2009 11:35:37 RTC::attach(&minTick, RTC::Minute); - + while(1)sleep(); return 0; } @@ -89,6 +90,7 @@ yellows.pulsewidth_us(yellowMs); blues.pulsewidth_us(blueMs); alarmActive = 0; + RTC::detach(RTC::Second); return; } else { if(!timeSetting) { @@ -155,16 +157,16 @@ } void lightSequence(){ if(redMs != 1000){ - redMs+=100; + redMs+=3; reds.pulsewidth_us(redMs); }else if (yellowMs!=1000){ - yellowMs+=100; + yellowMs+=3; yellows.pulsewidth_us(yellowMs); }else if (greenMs!=1000){ - greenMs+=100; + greenMs+=3; greens.pulsewidth_us(greenMs); }else if (blueMs!=1000){ - blueMs+=100; + blueMs+=1; blues.pulsewidth_us(blueMs); }else{ alarmActive = 0;