Example program with the color LEDs of the mbed application shield

Dependencies:   mbed

Committer:
screamer
Date:
Fri Feb 13 09:46:01 2015 +0000
Revision:
3:41ae038f7d29
Parent:
2:6cf5f4d0d948
Update mbed library.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
screamer 2:6cf5f4d0d948 1 /* Copyright (c) 2010-2011 mbed.org, MIT License
screamer 2:6cf5f4d0d948 2 *
screamer 2:6cf5f4d0d948 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
screamer 2:6cf5f4d0d948 4 * and associated documentation files (the "Software"), to deal in the Software without
screamer 2:6cf5f4d0d948 5 * restriction, including without limitation the rights to use, copy, modify, merge, publish,
screamer 2:6cf5f4d0d948 6 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
screamer 2:6cf5f4d0d948 7 * Software is furnished to do so, subject to the following conditions:
screamer 2:6cf5f4d0d948 8 *
screamer 2:6cf5f4d0d948 9 * The above copyright notice and this permission notice shall be included in all copies or
screamer 2:6cf5f4d0d948 10 * substantial portions of the Software.
screamer 2:6cf5f4d0d948 11 *
screamer 2:6cf5f4d0d948 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
screamer 2:6cf5f4d0d948 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
screamer 2:6cf5f4d0d948 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
screamer 2:6cf5f4d0d948 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
screamer 2:6cf5f4d0d948 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
screamer 2:6cf5f4d0d948 17 */
screamer 2:6cf5f4d0d948 18
screamer 0:5befba8e183e 19 #include "mbed.h"
screamer 0:5befba8e183e 20
screamer 0:5befba8e183e 21 DigitalOut led(LED1);
screamer 0:5befba8e183e 22 DigitalOut red(D5);
screamer 0:5befba8e183e 23 DigitalOut blue(D8);
screamer 0:5befba8e183e 24 DigitalOut green(D9);
screamer 0:5befba8e183e 25 int i;
screamer 0:5befba8e183e 26
screamer 0:5befba8e183e 27 int main()
screamer 0:5befba8e183e 28 {
screamer 0:5befba8e183e 29 while(1) {
screamer 0:5befba8e183e 30 for (i=1; i<7; i++) {
screamer 0:5befba8e183e 31 green = i & 1;
screamer 0:5befba8e183e 32 blue = i & 2;
screamer 0:5befba8e183e 33 red = i & 4;
screamer 0:5befba8e183e 34 led = led ? 0 : 1;
screamer 0:5befba8e183e 35 wait(0.2);
screamer 0:5befba8e183e 36 }
screamer 0:5befba8e183e 37 }
screamer 0:5befba8e183e 38 }