File content as of revision 0:12678c3187de:
/*
* wave2
*
*/
#include "mbed.h"
DigitalOut myled(LED1);
AnalogOut ano1(p18);
Ticker oscTick1;
float oscData[] =
// { 0,1,0,1,0,1 };
// { 0, .5 };
// { .33,.67,.33,.67,.33,.67 };
// { 0, .15, .05, .1 }; // 1:1
{ 0, .15, 0, .15, .05, .1, .05, .1, };
// {
// 0, .15, 0, .15, 0, .15, 0, .15, 0, .15, 0, .15, // 0, .15, 0, .15, 0, .15, 0, .15, 0, .15, 0, .15,
// .05, .1, .05, .1, .05, .1, .05, .1, .05, .1, .05, .1, // .05, .1, .05, .1, .05, .1, .05, .1, .05, .1, .05, .1,
// };
const int dx_max = sizeof(oscData)/sizeof(oscData[0]);
int dx = 0;
// ---------------------------------------------------------------------------
void oscOut1() {
// uint16_t v = (oscData[dx++]*0xFFFF)/3;
float v = oscData[dx++];
// ano1.write_u16(v);
ano1 = v;
if(dx >= dx_max) dx = 0;
}
// ---------------------------------------------------------------------------
int main() {
ano1 = 0;
oscTick1.attach_us(&oscOut1, 500); // chip period: 500-1KHz, 417-1200Hz, 833-600Hz
while(1) {
myled = 1;
wait(0.2);
myled = 0;
wait(0.2);
}
} // main