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.
main.cpp
00001 #include "mbed.h" 00002 00003 /* 00004 00005 based on http://mbed.org/forum/mbed/topic/1704/ 00006 00007 the Pwm part doesnt work; only led1 comes on 00008 00009 if the printf in the while is removed, or the PwmOut is moved to be static/global, all works fine 00010 00011 seems like a memory problem. 00012 */ 00013 00014 int main() { 00015 DigitalOut led1(LED1); 00016 float f=0.0; 00017 00018 PwmOut display(LED2); 00019 00020 display.period_ms(1); 00021 00022 display=f; 00023 00024 AnalogIn light(p20); 00025 00026 for (int i=0;i<100;i++) 00027 { 00028 f=f+0.01; 00029 display=f; 00030 wait (0.03); 00031 } 00032 printf("%f\n",display.read()); 00033 led1=1; 00034 00035 while (true) 00036 { 00037 double d=light; 00038 double sq=pow(d,0.6); 00039 display.write(sq*3); 00040 00041 printf("%f / %f\n",d,sq); 00042 wait(1); 00043 } 00044 }
Generated on Tue Jul 19 2022 05:44:19 by
1.7.2