Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: Hotboards_leds mbed
Fork of leds by
main.cpp
00001 00002 /* 00003 * Write a variable into a led bus 00004 * 00005 * Connections: 00006 * 00007 * PA_5 --- led0 00008 * PA_6 --- led1 00009 * PA_7 --- led2 00010 * PB_6 --- led3 00011 * PC_7 --- led4 00012 * PA_9 --- led5 00013 * PA_8 --- led6 00014 * PB_10 --- led8 00015 * 00016 */ 00017 00018 #include "mbed.h" 00019 #include "Hotboards_leds.h" 00020 00021 //Creates a bus with 8 leds 00022 // bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 00023 Hotboards_leds leds( PB_10 , PA_8 , PA_9 , PC_7 , PB_6 , PA_7 , PA_6 , PA_5 ); 00024 00025 uint8_t counter; 00026 00027 int main() 00028 { 00029 counter = 0; 00030 while(1) 00031 { 00032 //Shows on the led bus the counter variable value 00033 leds.write( counter ); 00034 wait_ms( 500 ); 00035 counter ++; 00036 //We can still manipulate each led individually with 00037 //the functions turnOn, turnOff, toggle, write, but in 00038 //this case the function will need a parameter indicating 00039 //the led you want to manipulate 00040 //Example: leds.turnOn(3) turns ON led #3 00041 } 00042 }
Generated on Mon Jul 18 2022 01:09:57 by
1.7.2
