The preloaded firmware shipped on the mBuino Development Board.
Dependencies: mbed
main.cpp@1:f89a6b63eae7, 2014-09-13 (annotated)
- Committer:
- gusissa
- Date:
- Sat Sep 13 16:27:29 2014 +0000
- Revision:
- 1:f89a6b63eae7
- Parent:
- 0:c72235e68f52
Added apache 2 license text
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gusissa | 1:f89a6b63eae7 | 1 | /* |
gusissa | 1:f89a6b63eae7 | 2 | ** This software can be freely used, even comercially, as highlighted in the license. |
gusissa | 1:f89a6b63eae7 | 3 | ** |
gusissa | 1:f89a6b63eae7 | 4 | ** Copyright 2014 GHI Electronics, LLC |
gusissa | 1:f89a6b63eae7 | 5 | ** |
gusissa | 1:f89a6b63eae7 | 6 | ** Licensed under the Apache License, Version 2.0 (the "License"); |
gusissa | 1:f89a6b63eae7 | 7 | ** you may not use this file except in compliance with the License. |
gusissa | 1:f89a6b63eae7 | 8 | ** You may obtain a copy of the License at |
gusissa | 1:f89a6b63eae7 | 9 | ** |
gusissa | 1:f89a6b63eae7 | 10 | ** http://www.apache.org/licenses/LICENSE-2.0 |
gusissa | 1:f89a6b63eae7 | 11 | ** |
gusissa | 1:f89a6b63eae7 | 12 | ** Unless required by applicable law or agreed to in writing, software |
gusissa | 1:f89a6b63eae7 | 13 | ** distributed under the License is distributed on an "AS IS" BASIS, |
gusissa | 1:f89a6b63eae7 | 14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
gusissa | 1:f89a6b63eae7 | 15 | ** See the License for the specific language governing permissions and |
gusissa | 1:f89a6b63eae7 | 16 | ** limitations under the License. |
gusissa | 1:f89a6b63eae7 | 17 | ** |
gusissa | 1:f89a6b63eae7 | 18 | **/ |
gusissa | 1:f89a6b63eae7 | 19 | |
Experiment626 | 0:c72235e68f52 | 20 | #include "mbed.h" |
Experiment626 | 0:c72235e68f52 | 21 | |
Experiment626 | 0:c72235e68f52 | 22 | DigitalOut LED[] = {(LED1), (LED2), (LED3), (LED4), (LED5), (LED6), (LED7)};// declare 7 LEDs |
Experiment626 | 0:c72235e68f52 | 23 | |
Experiment626 | 0:c72235e68f52 | 24 | float delayTime = .05; |
Experiment626 | 0:c72235e68f52 | 25 | |
Experiment626 | 0:c72235e68f52 | 26 | int main() |
Experiment626 | 0:c72235e68f52 | 27 | { |
Experiment626 | 0:c72235e68f52 | 28 | while(1) |
Experiment626 | 0:c72235e68f52 | 29 | { |
Experiment626 | 0:c72235e68f52 | 30 | delayTime = 0.05; |
Experiment626 | 0:c72235e68f52 | 31 | for(int x = 0; x < 7; x++) |
Experiment626 | 0:c72235e68f52 | 32 | { |
Experiment626 | 0:c72235e68f52 | 33 | LED[x] = 1; // turn on |
Experiment626 | 0:c72235e68f52 | 34 | wait(.2); // delay |
Experiment626 | 0:c72235e68f52 | 35 | |
Experiment626 | 0:c72235e68f52 | 36 | LED[x] = 0; // turn off |
Experiment626 | 0:c72235e68f52 | 37 | wait(delayTime); // delay |
Experiment626 | 0:c72235e68f52 | 38 | } |
Experiment626 | 0:c72235e68f52 | 39 | for(int x = 6; x >= 0; x--) |
Experiment626 | 0:c72235e68f52 | 40 | { |
Experiment626 | 0:c72235e68f52 | 41 | LED[x] = 1; // turn on |
Experiment626 | 0:c72235e68f52 | 42 | wait(.2); // delay |
Experiment626 | 0:c72235e68f52 | 43 | |
Experiment626 | 0:c72235e68f52 | 44 | LED[x] = 0; // turn off |
Experiment626 | 0:c72235e68f52 | 45 | wait(delayTime); // delay |
Experiment626 | 0:c72235e68f52 | 46 | } |
Experiment626 | 0:c72235e68f52 | 47 | |
Experiment626 | 0:c72235e68f52 | 48 | for(int x = 0; x < 7; x++) |
Experiment626 | 0:c72235e68f52 | 49 | { |
Experiment626 | 0:c72235e68f52 | 50 | LED[x] = 1; // turn on |
Experiment626 | 0:c72235e68f52 | 51 | wait(delayTime); // delay |
Experiment626 | 0:c72235e68f52 | 52 | } |
Experiment626 | 0:c72235e68f52 | 53 | for(int x = 6; x >= 0; x--) |
Experiment626 | 0:c72235e68f52 | 54 | { |
Experiment626 | 0:c72235e68f52 | 55 | LED[x] = 0; // turn off |
Experiment626 | 0:c72235e68f52 | 56 | wait(delayTime); // delay |
Experiment626 | 0:c72235e68f52 | 57 | } |
Experiment626 | 0:c72235e68f52 | 58 | |
Experiment626 | 0:c72235e68f52 | 59 | |
Experiment626 | 0:c72235e68f52 | 60 | } |
Experiment626 | 0:c72235e68f52 | 61 | } |