ABELI2019 / Mbed 2 deprecated Nucleo_blink_led

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 BusOut led(LED1,LED2,LED3,LED4);
00004 BusIn jst (p12,p13,p14,p15,p16);
00005 
00006 
00007 int main() {
00008 
00009   led = 0x0;
00010 
00011 
00012 
00013   while (1) {
00014 
00015     if(jst & 0x2){
00016 
00017       led = 0xF;
00018 
00019       for(int i=0;i<4;i++){
00020 
00021         led = led<<1;
00022 
00023         wait_ms(200);
00024       }
00025     }
00026 
00027     if(jst & 0x10){
00028 
00029       led = 0x0;
00030 
00031       for(int i=0;i<4;i++){
00032 
00033         led = (led>>1) | 0x8;
00034 
00035         wait_ms(100);
00036       }
00037     }
00038 
00039     
00040     
00041     
00042     
00043   }
00044 
00045   return 0;
00046 }