fork of Official_mBuino
Dependencies: mbed
Fork of Official_mBuino by
main.cpp@2:4430b59c748f, 2015-05-20 (annotated)
- Committer:
- dyeske
- Date:
- Wed May 20 21:15:23 2015 +0000
- Revision:
- 2:4430b59c748f
- Parent:
- 1:f89a6b63eae7
- Child:
- 3:59a791514a87
first commit
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; |
dyeske | 2:4430b59c748f | 25 | float delayMe = .01; |
Experiment626 | 0:c72235e68f52 | 26 | |
dyeske | 2:4430b59c748f | 27 | int main() { |
dyeske | 2:4430b59c748f | 28 | while(1) { |
Experiment626 | 0:c72235e68f52 | 29 | delayTime = 0.05; |
Experiment626 | 0:c72235e68f52 | 30 | for(int x = 0; x < 7; x++) |
Experiment626 | 0:c72235e68f52 | 31 | { |
Experiment626 | 0:c72235e68f52 | 32 | LED[x] = 1; // turn on |
dyeske | 2:4430b59c748f | 33 | wait(delayMe); // delay |
Experiment626 | 0:c72235e68f52 | 34 | |
Experiment626 | 0:c72235e68f52 | 35 | LED[x] = 0; // turn off |
Experiment626 | 0:c72235e68f52 | 36 | wait(delayTime); // delay |
Experiment626 | 0:c72235e68f52 | 37 | } |
Experiment626 | 0:c72235e68f52 | 38 | for(int x = 6; x >= 0; x--) |
Experiment626 | 0:c72235e68f52 | 39 | { |
Experiment626 | 0:c72235e68f52 | 40 | LED[x] = 1; // turn on |
Experiment626 | 0:c72235e68f52 | 41 | wait(.2); // delay |
Experiment626 | 0:c72235e68f52 | 42 | |
Experiment626 | 0:c72235e68f52 | 43 | LED[x] = 0; // turn off |
Experiment626 | 0:c72235e68f52 | 44 | wait(delayTime); // delay |
Experiment626 | 0:c72235e68f52 | 45 | } |
Experiment626 | 0:c72235e68f52 | 46 | |
Experiment626 | 0:c72235e68f52 | 47 | for(int x = 0; x < 7; x++) |
Experiment626 | 0:c72235e68f52 | 48 | { |
Experiment626 | 0:c72235e68f52 | 49 | LED[x] = 1; // turn on |
Experiment626 | 0:c72235e68f52 | 50 | wait(delayTime); // delay |
Experiment626 | 0:c72235e68f52 | 51 | } |
Experiment626 | 0:c72235e68f52 | 52 | for(int x = 6; x >= 0; x--) |
Experiment626 | 0:c72235e68f52 | 53 | { |
Experiment626 | 0:c72235e68f52 | 54 | LED[x] = 0; // turn off |
Experiment626 | 0:c72235e68f52 | 55 | wait(delayTime); // delay |
Experiment626 | 0:c72235e68f52 | 56 | } |
Experiment626 | 0:c72235e68f52 | 57 | |
Experiment626 | 0:c72235e68f52 | 58 | |
Experiment626 | 0:c72235e68f52 | 59 | } |
Experiment626 | 0:c72235e68f52 | 60 | } |