andres castaño / Mbed 2 deprecated farith

Dependencies:   mbed Servo TextLCD

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "TextLCD.h"
00003 #include "Servo.h"
00004 TextLCD lcd(D0,D1,D2,D3,D4,D5, TextLCD::LCD16x2 );
00005 AnalogIn ain(A0);
00006 Servo led(PTD5);
00007 //PwmOut led(PB_0);
00008 float p;8
00009 
00010 int main()
00011 {
00012     led.calibrate(0.0015,180);
00013     
00014     while(1) {
00015         lcd.cls();
00016         p=ain.read();
00017         lcd.printf("porcen: %1.4f",p);
00018         if(p<0.5) {
00019             for(int i=0; i<100; i++) {
00020                 led = i/100.0;
00021                 wait(0.01);
00022             }
00023         } else {
00024             for(int i=100; i>0; i--) {
00025                 led = i/100.0;
00026                 wait(0.01);
00027             }
00028         }
00029     }
00030 }