
Example program for the Seeed Grove shield, that uses Grove LED Bar by SeeedStudio on D5 connector (D6/D5 pins). This program raises the bar from 0 to 10.
main.cpp@0:2ae0ac3db9b7, 2014-07-30 (annotated)
- Committer:
- screamer
- Date:
- Wed Jul 30 13:34:57 2014 +0000
- Revision:
- 0:2ae0ac3db9b7
Initial revision
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" |
screamer | 0:2ae0ac3db9b7 | 20 | #include "LED_Bar.h" |
screamer | 0:2ae0ac3db9b7 | 21 | |
screamer | 0:2ae0ac3db9b7 | 22 | LED_Bar bar(D6, D5); |
screamer | 0:2ae0ac3db9b7 | 23 | |
screamer | 0:2ae0ac3db9b7 | 24 | int main() { |
screamer | 0:2ae0ac3db9b7 | 25 | int i; |
screamer | 0:2ae0ac3db9b7 | 26 | while(1) { |
screamer | 0:2ae0ac3db9b7 | 27 | for (i=0; i<=10; i++) { |
screamer | 0:2ae0ac3db9b7 | 28 | bar.setLevel(i); |
screamer | 0:2ae0ac3db9b7 | 29 | wait(0.1); |
screamer | 0:2ae0ac3db9b7 | 30 | } |
screamer | 0:2ae0ac3db9b7 | 31 | } |
screamer | 0:2ae0ac3db9b7 | 32 | } |