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:
- gitakichi
- Date:
- 2016-07-20
- Revision:
- 2:47210a089f76
- Parent:
- 1:1b9ca25019a6
- Child:
- 3:5cae780fe61e
File content as of revision 2:47210a089f76:
#include "mbed.h"
Ticker flipper;
PwmOut mypwm(PC_8);
DigitalOut myled(LED1);
int data;
float data_sin;
void flip(){
if(data > 100) data = 0;
else data++;
data_sin = sin((data/100)*6.28) + 1;
}
int main() {
mypwm.period_us(10);
flipper.attach_us(&flip, 20);
//printf("pwm set to %.2f %%\n", mypwm.read() * 100);
while(1) {
mypwm.write( data_sin / 10 );
}
}