An example program to use the Seeed Grove Circular LED.
Dependencies: Circular_LED mbed
Fork of Seeed_Grove_Shield_LED_Bar by
main.cpp@3:f7241faa2815, 2017-06-16 (annotated)
- Committer:
- mochen
- Date:
- Fri Jun 16 16:11:32 2017 +0000
- Revision:
- 3:f7241faa2815
- Parent:
- 2:2f368bcc7599
Use the circular LED library.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
screamer | 0:2ae0ac3db9b7 | 1 | /* Copyright (c) 2010-2011 mbed.org, MIT License |
screamer | 0:2ae0ac3db9b7 | 2 | * |
screamer | 0:2ae0ac3db9b7 | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
screamer | 0:2ae0ac3db9b7 | 4 | * and associated documentation files (the "Software"), to deal in the Software without |
screamer | 0:2ae0ac3db9b7 | 5 | * restriction, including without limitation the rights to use, copy, modify, merge, publish, |
screamer | 0:2ae0ac3db9b7 | 6 | * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the |
screamer | 0:2ae0ac3db9b7 | 7 | * Software is furnished to do so, subject to the following conditions: |
screamer | 0:2ae0ac3db9b7 | 8 | * |
screamer | 0:2ae0ac3db9b7 | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
screamer | 0:2ae0ac3db9b7 | 10 | * substantial portions of the Software. |
screamer | 0:2ae0ac3db9b7 | 11 | * |
screamer | 0:2ae0ac3db9b7 | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
screamer | 0:2ae0ac3db9b7 | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
screamer | 0:2ae0ac3db9b7 | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
screamer | 0:2ae0ac3db9b7 | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
screamer | 0:2ae0ac3db9b7 | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
screamer | 0:2ae0ac3db9b7 | 17 | */ |
screamer | 0:2ae0ac3db9b7 | 18 | |
screamer | 0:2ae0ac3db9b7 | 19 | #include "mbed.h" |
mochen | 2:2f368bcc7599 | 20 | #include "Circular_LED.h" |
screamer | 0:2ae0ac3db9b7 | 21 | |
mochen | 2:2f368bcc7599 | 22 | Circular_LED circle(D5, D6); |
screamer | 0:2ae0ac3db9b7 | 23 | |
screamer | 0:2ae0ac3db9b7 | 24 | int main() { |
screamer | 0:2ae0ac3db9b7 | 25 | int i; |
screamer | 0:2ae0ac3db9b7 | 26 | while(1) { |
mochen | 2:2f368bcc7599 | 27 | for (i = 0; i <= 24; i++) { |
mochen | 2:2f368bcc7599 | 28 | circle.setLevel(i); |
mochen | 2:2f368bcc7599 | 29 | wait(0.1); |
mochen | 2:2f368bcc7599 | 30 | } |
mochen | 2:2f368bcc7599 | 31 | for (i = 0; i < 24; i++) { |
mochen | 2:2f368bcc7599 | 32 | circle.setSingleLed(i, false); |
mochen | 2:2f368bcc7599 | 33 | wait(0.1); |
mochen | 2:2f368bcc7599 | 34 | } |
mochen | 2:2f368bcc7599 | 35 | for (i = 0; i < 24; i++) { |
mochen | 2:2f368bcc7599 | 36 | circle.setState(i % 2 ? 0xAAAAAA : 0x555555); |
screamer | 0:2ae0ac3db9b7 | 37 | wait(0.1); |
screamer | 0:2ae0ac3db9b7 | 38 | } |
screamer | 0:2ae0ac3db9b7 | 39 | } |
screamer | 0:2ae0ac3db9b7 | 40 | } |