fork of Official_mBuino

Dependencies:   mbed

Fork of Official_mBuino by David Yeske

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /*
00002 ** This software can be freely used, even comercially, as highlighted in the license.
00003 ** 
00004 ** Copyright 2014 GHI Electronics, LLC
00005 ** 
00006 ** Licensed under the Apache License, Version 2.0 (the "License");
00007 ** you may not use this file except in compliance with the License.
00008 ** You may obtain a copy of the License at
00009 ** 
00010 **     http://www.apache.org/licenses/LICENSE-2.0
00011 ** 
00012 ** Unless required by applicable law or agreed to in writing, software
00013 ** distributed under the License is distributed on an "AS IS" BASIS,
00014 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015 ** See the License for the specific language governing permissions and
00016 ** limitations under the License.
00017 **
00018 **/
00019 
00020 //fix the comment
00021 
00022 #include "mbed.h"
00023 
00024 DigitalOut LED[] = {(LED1), (LED2), (LED3), (LED4), (LED5), (LED6), (LED7)};// declare 7 LEDs
00025 
00026 float delayTime = .05;
00027 float delayMe = .01;
00028 
00029 int main() {
00030 
00031     while(1) {
00032         delayTime = 0.05;
00033         for(int x = 0; x < 7; x++) {
00034             LED[x] = 1; // turn on
00035             wait(delayMe); // delay
00036         
00037             LED[x] = 0; // turn off
00038             wait(delayTime); // delay
00039         }
00040         for(int x = 6; x >= 0; x--) {
00041             LED[x] = 1; // turn on
00042             wait(delayMe); // delay
00043         
00044             LED[x] = 0; // turn off
00045             wait(delayTime); // delay
00046         }
00047 
00048         for(int x = 0; x < 7; x++) {
00049             LED[x] = 1; // turn on
00050             wait(delayTime); // delay
00051         }
00052         for(int x = 6; x >= 0; x--) {
00053             LED[x] = 0; // turn off
00054             wait(delayTime); // delay
00055         }
00056         
00057 
00058     }
00059 }