Gitakichi Tokyo / Mbed 2 deprecated AnalogModelingSynthesizer

Dependencies:   mbed

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 );
    }
}