Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed Servo TextLCD
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 }
Generated on Tue Aug 23 2022 19:39:39 by
1.7.2