led manipulating in some ways
Dependencies: Hotboards_leds mbed
main.cpp
00001 00002 /* 00003 * On this example we will show how to manipulate your leds 00004 * in different ways; the first 4 and the following 3 are 00005 * grouped into a bus each one and manipulated individually, 00006 * and the last 1 is alone and manipulated individually. 00007 * 00008 * Connections: 00009 * 00010 * PA_5 --- led0 \ 00011 * PA_6 --- led1 > leds 00012 * PA_7 --- led2 / 00013 * PB_6 --- led3 | 00014 * 00015 * PC_7 --- led4 \ 00016 * PA_9 --- led5 > leds765 00017 * PA_8 --- led6 / 00018 * 00019 * PB_10 --- led8 > led8 00020 * 00021 */ 00022 00023 #include "mbed.h" 00024 #include "Hotboards_leds.h" 00025 00026 //Creates a bus with 4 leds 00027 Hotboards_leds leds( PB_6 , PA_7 , PA_6 , PA_5 ); 00028 //Creates a bus with 3 leds that will be manipulated individually 00029 Hotboards_leds leds765( PA_8 , PA_9 , PC_7 ); 00030 //Creates a single led on pin PB_10 00031 Hotboards_leds led8( PB_10 ); 00032 00033 uint8_t counter; 00034 00035 int main() 00036 { 00037 counter = 0; 00038 while(1) 00039 { 00040 //Turns ON leds 5, 6 & 7, at the same time 00041 leds765.turnOn( 0 ); 00042 leds765.turnOn( 1 ); 00043 leds765.turnOn( 2 ); 00044 wait_ms( 200 ); 00045 //Turns OFF leds 5, 6 & 7, at the same time 00046 leds765.turnOff( 0 ); 00047 leds765.turnOff( 1 ); 00048 leds765.turnOff( 2 ); 00049 wait_ms( 200 ); 00050 //Toggle led numer 8 00051 led8.toggle( ); 00052 //Writes the 4 LSB of variable counter on leds 1, 2, 3 & 4 00053 leds.write( counter ); 00054 counter ++; 00055 } 00056 }
Generated on Tue Jul 12 2022 22:35:45 by
1.7.2
Roman Valencia