Kohei Matsumura / Mbed 2 deprecated binary_indicator

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 //LEDs indicate a number as binary numeral system and the number is increasing with 0.2sec intervals.
00002 //by Kohei Matsumura
00003 
00004 #include "mbed.h"
00005 
00006 DigitalOut led1(LED1);
00007 DigitalOut led2(LED2);
00008 DigitalOut led3(LED3);
00009 DigitalOut led4(LED4);
00010 
00011 int main() {
00012     int i=0;
00013     
00014     while(1) {    
00015         wait(0.2);
00016         led1 = i & 0x01;
00017         led2 = i>>1 & 0x01;
00018         led3 = i>>2 & 0x01;
00019         led4 = i>>3 & 0x01;
00020         
00021         if(i>0x0f){
00022             i=0;
00023         }else{
00024             i++;
00025         }
00026     }
00027 }