![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
test00
Fork of test01 by
Diff: main.cpp
- Revision:
- 2:76f0ff8c3068
- Parent:
- 1:c5360811157c
--- a/main.cpp Wed Nov 02 17:56:38 2016 +0000 +++ b/main.cpp Wed Nov 09 17:17:07 2016 +0000 @@ -25,16 +25,22 @@ // Print to terminal pc.printf("Ready.......FIGHT!\r\n"); double freqf; + double buffer [100]; + int cut = 0; + // if statement //freqf = 0.5; freqf = 0.05; - - - + + while( cut < 100){ + buffer[ cut ] = sin( 2 * 3.1415926 * cut / 100); + cut++; + } + - + while(1) { - + /* testLed = 1; wait(freqf); // Write to DAC register (not EEPROM). Documentation in library files. @@ -43,8 +49,24 @@ pc.printf("Value is %f V \r\n",analogIn.read()*3.3); wait(freqf); bacon.write(MCP4725::Normal, (0x000 * (1.0/3.3) ), false); + */ + + + + testLed = 1; + + if ( cut == 100) + { + cut = 0; + } + + bacon.write(MCP4725::Normal, (buffer[cut] * 0xFFF * (1.0/3.32) ), false); + cut++; + + wait(freqf/100); // Print ADC measurement to terminal. Scale factor of 3.3 needed for internal ADC. pc.printf("Value is %f V \r\n",analogIn.read()*3.3); + } } \ No newline at end of file