jim hamblen / Mbed 2 deprecated Cylon_LED

Dependencies:   mbed

Committer:
4180_1
Date:
Thu Aug 26 19:00:18 2010 +0000
Revision:
1:13ed59a7806b
Parent:
0:a0ff9388a0b8

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
4180_1 1:13ed59a7806b 1 #include "mbed.h"
4180_1 1:13ed59a7806b 2 // Cylon style LED scanner
4180_1 1:13ed59a7806b 3 BusOut led_state(LED1, LED2, LED3, LED4);
4180_1 1:13ed59a7806b 4
4180_1 1:13ed59a7806b 5 int main() {
4180_1 1:13ed59a7806b 6 int i = 0;
4180_1 1:13ed59a7806b 7 // initinal LED state
4180_1 1:13ed59a7806b 8 led_state = 0x1;
4180_1 1:13ed59a7806b 9 while (1) {
4180_1 1:13ed59a7806b 10 // loop through all states
4180_1 1:13ed59a7806b 11 for (i=0; i<6; i++) {
4180_1 1:13ed59a7806b 12 if (i<3)
4180_1 1:13ed59a7806b 13 // shift left 1 bit until high LED set
4180_1 1:13ed59a7806b 14 led_state = led_state << 1;
4180_1 1:13ed59a7806b 15 else
4180_1 1:13ed59a7806b 16 // then reverse and shift back to right 1 bit
4180_1 1:13ed59a7806b 17 led_state = led_state >> 1;
4180_1 1:13ed59a7806b 18 // time delay .1s to slow down display
4180_1 1:13ed59a7806b 19 wait(0.1);
4180_1 1:13ed59a7806b 20 }
4180_1 1:13ed59a7806b 21 }
4180_1 1:13ed59a7806b 22 }