fork of Official_mBuino
Dependencies: mbed
Fork of Official_mBuino by
main.cpp@3:59a791514a87, 2015-05-20 (annotated)
- Committer:
- David Yeske
- Date:
- Wed May 20 17:41:33 2015 -0400
- Revision:
- 3:59a791514a87
- Parent:
- 2:4430b59c748f
- Child:
- 4:f91b7024a784
doing this from home
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() { |
David Yeske |
3:59a791514a87 | 28 | |
dyeske | 2:4430b59c748f | 29 | while(1) { |
Experiment626 | 0:c72235e68f52 | 30 | delayTime = 0.05; |
David Yeske |
3:59a791514a87 | 31 | for(int x = 0; x < 7; x++) { |
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 | } |
David Yeske |
3:59a791514a87 | 38 | for(int x = 6; x >= 0; x--) { |
Experiment626 | 0:c72235e68f52 | 39 | LED[x] = 1; // turn on |
Experiment626 | 0:c72235e68f52 | 40 | wait(.2); // delay |
Experiment626 | 0:c72235e68f52 | 41 | |
Experiment626 | 0:c72235e68f52 | 42 | LED[x] = 0; // turn off |
Experiment626 | 0:c72235e68f52 | 43 | wait(delayTime); // delay |
Experiment626 | 0:c72235e68f52 | 44 | } |
Experiment626 | 0:c72235e68f52 | 45 | |
David Yeske |
3:59a791514a87 | 46 | for(int x = 0; x < 7; x++) { |
Experiment626 | 0:c72235e68f52 | 47 | LED[x] = 1; // turn on |
Experiment626 | 0:c72235e68f52 | 48 | wait(delayTime); // delay |
Experiment626 | 0:c72235e68f52 | 49 | } |
David Yeske |
3:59a791514a87 | 50 | for(int x = 6; x >= 0; x--) { |
Experiment626 | 0:c72235e68f52 | 51 | LED[x] = 0; // turn off |
Experiment626 | 0:c72235e68f52 | 52 | wait(delayTime); // delay |
Experiment626 | 0:c72235e68f52 | 53 | } |
Experiment626 | 0:c72235e68f52 | 54 | |
Experiment626 | 0:c72235e68f52 | 55 | |
Experiment626 | 0:c72235e68f52 | 56 | } |
Experiment626 | 0:c72235e68f52 | 57 | } |