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.
LedBar Class Reference
LedBar class is used for controlling 6 led bar. More...
#include <6LedBar.h>
Public Member Functions | |
| void | on (int n) |
| Turn n-s led on. | |
| void | off (int n) |
| Turn n-s led off. | |
| void | toggle (int n) |
| Toggle n-s led. | |
| void | set_mask (int m) |
| Set bit mask. | |
| void | on_mask (int m) |
| Turn on leds specified by bit-mask. | |
| void | off_mask (int m) |
| Turn off leds specified by bit-mask. | |
| void | toggle_mask (int m) |
| Toggle leds specified by bit-mask. | |
Detailed Description
LedBar class is used for controlling 6 led bar.
Example using on, off, toggle methods:
#include "mbed.h" #include "6LedBar.h" LedBar leds (A0, A1, A2, A3, A4, A5); int main() { leds.on(0); leds.on(2); leds.on(4); while(true) { for(int i = 0; i < 6; i++) { leds.toggle(i); } wait(0.5); } }
* * * * * * * * * * * * * * * * * * * * * * * *
Example using mask methods:
#include "mbed.h" #include "6LedBar.h" LedBar leds (A0, A1, A2, A3, A4, A5); int main() { leds.set_mask(0b010101); while(true) { leds.toggle_mask(0b111111); wait(0.5); } }
Definition at line 84 of file 6LedBar.h.
Member Function Documentation
| void off | ( | int | n ) |
Turn n-s led off.
Definition at line 22 of file 6LedBar.cpp.
| void off_mask | ( | int | m ) |
Turn off leds specified by bit-mask.
Definition at line 42 of file 6LedBar.cpp.
| void on | ( | int | n ) |
Turn n-s led on.
Definition at line 16 of file 6LedBar.cpp.
| void on_mask | ( | int | m ) |
Turn on leds specified by bit-mask.
Definition at line 34 of file 6LedBar.cpp.
| void set_mask | ( | int | m ) |
Set bit mask.
Definition at line 58 of file 6LedBar.cpp.
| void toggle | ( | int | n ) |
Toggle n-s led.
Definition at line 28 of file 6LedBar.cpp.
| void toggle_mask | ( | int | m ) |
Toggle leds specified by bit-mask.
Definition at line 50 of file 6LedBar.cpp.
Generated on Tue Jul 12 2022 15:23:02 by
1.7.2