SelbstTest2

Dependencies:   mbed

main.cpp

Committer:
Wizo
Date:
2018-11-15
Revision:
0:bfb11ea418eb

File content as of revision 0:bfb11ea418eb:

/ host terminal LED dimmer control

#include "mbed.h"
#include "C12832.h"

C12832 lcd(p5, p7, p6, p8, p11);

PwmOut led(LED1);
float brightness=0.0;
int main()
{
    lcd.locate(0,0);
    lcd.printf(“Control of LED dimmer by host terminal\n\r");

               lcd.locate(0,10);
               lcd.printf("Press 'u‘ = brighter, 'd‘ = dimmer\n\r");

                       while(1) { char c = pc.getc(); wait(0.001);

                       if((c == 'u') && (brightness < 0.1))
                   { brightness += 0.001; led = brightness; }
                       if((c == 'd') && (brightness > 0.0))
                   { brightness -= 0.001; led = brightness; }


                       lcd.locate(0,20);
                       lcd.printf("%c %1.3f \n \r",c,brightness); }
                   }