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
- Committer:
- simon
- Date:
- 2011-01-20
- Revision:
- 1:4115ae4cbc76
- Parent:
- 0:c795e64e9eb0
File content as of revision 1:4115ae4cbc76:
#include "mbed.h"
/*
based on http://mbed.org/forum/mbed/topic/1704/
the Pwm part doesnt work; only led1 comes on
if the printf in the while is removed, or the PwmOut is moved to be static/global, all works fine
seems like a memory problem.
*/
int main() {
DigitalOut led1(LED1);
float f=0.0;
PwmOut display(LED2);
display.period_ms(1);
display=f;
AnalogIn light(p20);
for (int i=0;i<100;i++)
{
f=f+0.01;
display=f;
wait (0.03);
}
printf("%f\n",display.read());
led1=1;
while (true)
{
double d=light;
double sq=pow(d,0.6);
display.write(sq*3);
printf("%f / %f\n",d,sq);
wait(1);
}
}