Quentin LAM / Mbed 2 deprecated ex26

Dependencies:   IHM_V2 mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "Nboard.h"
00002 
00003 
00004 IHM ihm;
00005 
00006 int main()
00007 {
00008     UINT16 val,pota,decal;
00009     float pot;
00010     while(1) {
00011         BusSelMux=Ana7;
00012         wait_us(1);
00013         val=AnaIn.read_u16();
00014         pot=AnaIn.read();
00015         pota=val;
00016         decal=val;
00017         pota=pota>>4;
00018         ihm.LCD_gotoxy(0,0);
00019         ihm.LCD_printf("POT=%04X=%3.2f",val,pot);
00020         ihm.LCD_gotoxy(1,0);
00021         ihm.LCD_printf("POT=%X=%5d",pota,pota); 
00022         decal=decal>>8;
00023         //Bus8Leds=decal;
00024         if(pot==0.5){
00025             Bus8Leds=0x0F;
00026             }
00027             if(pot>=0.75){
00028                 Bus8Leds=0x3F;
00029                 }
00030                 else{
00031                     Bus8Leds=0x00;
00032                     }
00033     }
00034 }