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: TSI TextLCD mbed
main.cpp
00001 #include "mbed.h" 00002 #include "TSISensor.h" 00003 #include "TextLCD.h" 00004 00005 00006 float value=0,valuev=0; 00007 TextLCD lcd(PTB10, PTB11, PTE2, PTE3, PTE4, PTE5); // rs, e, d4-d7 00008 00009 int main(void) { 00010 00011 //lcd.writeCommand(0x0E); 00012 00013 00014 PwmOut led(LED_BLUE); 00015 PwmOut pin(PTD4); 00016 float p=0.003; 00017 led.period(p); 00018 //pin.pulsewidth(p); 00019 pin.period(p); 00020 lcd.printf("Periodo=%gs",p); 00021 lcd.locate(0,1); 00022 lcd.printf("cycle duty=0"); 00023 TSISensor tsi; 00024 led = 1; 00025 int d; 00026 while (true) { 00027 value=tsi.readPercentage(); 00028 if(value!=valuev && value!=0) 00029 { 00030 00031 // pin = 1.0 - value; 00032 pin.write(1.0 - value); 00033 led.write(value); 00034 d=(1-value)*100; 00035 lcd.locate(0,1); 00036 lcd.printf(" "); 00037 lcd.locate(0,1); 00038 lcd.printf("cycle duty=%d",d); 00039 valuev=value; 00040 } 00041 // wait(0.1); 00042 00043 } 00044 }
Generated on Wed Jul 27 2022 09:17:30 by
1.7.2