Upload
Fork of RenBED_RGB by
Revision 2:e3fcde2894be, committed 2016-04-19
- Comitter:
- DanArgust
- Date:
- Tue Apr 19 06:56:32 2016 +0000
- Parent:
- 1:333227007cea
- Commit message:
- Upload
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 333227007cea -r e3fcde2894be main.cpp --- a/main.cpp Fri Apr 15 07:22:32 2016 +0000 +++ b/main.cpp Tue Apr 19 06:56:32 2016 +0000 @@ -14,8 +14,8 @@ /* Set up 3 pins as digital out to control the colour cathodes of the RGB LED */ -DigitalOut Red(p18); -DigitalOut Green(p20); +DigitalOut Green(p18); +DigitalOut Red(p20); DigitalOut Blue(p19); /* the main function is where a program will begin to execute. */ @@ -33,25 +33,38 @@ { /* open a for loop with no parameters to start an infinite loop */ for(;;){ - Red = 0; /* As we are controlling colour cathodes, we must pull the pin low to turn on the colour */ - wait_ms(1000); - Blue = 0; /* Colours are combined by switching multiple colour pins on at once */ - wait_ms(1000); - Red = 1; /* Pull the red pin high to switch it off */ + Red = 1; + Blue = 1; + Green = 1; wait_ms(1000); - Green = 0; - wait_ms(1000); + Red = 1; Blue = 1; + Green = 0; wait_ms(1000); - Red = 0; + Red = 1; + Blue = 0; + Green = 1; wait_ms(1000); Red = 1; Blue = 0; + Green = 0; + wait_ms(1000); + Red = 0; + Blue = 1; + Green = 1; wait_ms(1000); Red = 0; + Blue = 1; + Green = 0; wait_ms(1000); - Red = Blue = Green = 1; /* Switch off all colours */ + Red = 0; + Blue = 0; + Green = 1; wait_ms(1000); + Red = 0; + Blue = 0; + Green = 0; + wait_ms(3000); } }