Four Squared
/
SinTest
with sin wave
Fork of test01 by
Revision 2:8fc9f673d972, committed 2016-11-09
- Comitter:
- xWhitfordx
- Date:
- Wed Nov 09 18:54:40 2016 +0000
- Parent:
- 1:c5360811157c
- Commit message:
- With sin wave
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r c5360811157c -r 8fc9f673d972 main.cpp --- a/main.cpp Wed Nov 02 17:56:38 2016 +0000 +++ b/main.cpp Wed Nov 09 18:54:40 2016 +0000 @@ -26,11 +26,12 @@ pc.printf("Ready.......FIGHT!\r\n"); double freqf; // if statement - //freqf = 0.5; - freqf = 0.05; + freqf = 0.5; + //freqf = 0.05; - + //if statement + freqf = freqf/25; while(1) { @@ -38,7 +39,117 @@ testLed = 1; wait(freqf); // Write to DAC register (not EEPROM). Documentation in library files. - bacon.write(MCP4725::Normal, (0xFFF * (1.0/3.32) ), false); + bacon.write(MCP4725::Normal, (0xFFF * (1.0/3.32) * 0.5 ), false); + + pc.printf("Value is %f V \r\n",analogIn.read()*3.3); + + + wait(freqf); + // Write to DAC register (not EEPROM). Documentation in library files. + bacon.write(MCP4725::Normal, (0xFFF * (1.0/3.32) * 0.625 ), false); + + wait(freqf); + // Write to DAC register (not EEPROM). Documentation in library files. + bacon.write(MCP4725::Normal, (0xFFF * (1.0/3.32) * 0.741 ), false); + + wait(freqf); + // Write to DAC register (not EEPROM). Documentation in library files. + bacon.write(MCP4725::Normal, (0xFFF * (1.0/3.32) * 0.842 ), false); + + wait(freqf); + // Write to DAC register (not EEPROM). Documentation in library files. + bacon.write(MCP4725::Normal, (0xFFF * (1.0/3.32) * 0.922 ), false); + + pc.printf("Value is %f V \r\n",analogIn.read()*3.3); + + + wait(freqf); + // Write to DAC register (not EEPROM). Documentation in library files. + bacon.write(MCP4725::Normal, (0xFFF * (1.0/3.32) * 0.976 ), false); + + wait(freqf); + // Write to DAC register (not EEPROM). Documentation in library files. + bacon.write(MCP4725::Normal, (0xFFF * (1.0/3.32) * 0.999 ), false); + + wait(freqf); + // Write to DAC register (not EEPROM). Documentation in library files. + bacon.write(MCP4725::Normal, (0xFFF * (1.0/3.32) * 0.991 ), false); + + wait(freqf); + // Write to DAC register (not EEPROM). Documentation in library files. + bacon.write(MCP4725::Normal, (0xFFF * (1.0/3.32) * 0.952 ), false); + + pc.printf("Value is %f V \r\n",analogIn.read()*3.3); + + + wait(freqf); + // Write to DAC register (not EEPROM). Documentation in library files. + bacon.write(MCP4725::Normal, (0xFFF * (1.0/3.32) * 0.885 ), false); + + wait(freqf); + // Write to DAC register (not EEPROM). Documentation in library files. + bacon.write(MCP4725::Normal, (0xFFF * (1.0/3.32) * 0.794 ), false); + + wait(freqf); + // Write to DAC register (not EEPROM). Documentation in library files. + bacon.write(MCP4725::Normal, (0xFFF * (1.0/3.32) * 0.684 ), false); + + wait(freqf); + // Write to DAC register (not EEPROM). Documentation in library files. + bacon.write(MCP4725::Normal, (0xFFF * (1.0/3.32) * 0.563 ), false); + + pc.printf("Value is %f V \r\n",analogIn.read()*3.3); + + + wait(freqf); + // Write to DAC register (not EEPROM). Documentation in library files. + bacon.write(MCP4725::Normal, (0xFFF * (1.0/3.32) * 0.437 ), false); + + wait(freqf); + // Write to DAC register (not EEPROM). Documentation in library files. + bacon.write(MCP4725::Normal, (0xFFF * (1.0/3.32) * 0.316 ), false); + + wait(freqf); + // Write to DAC register (not EEPROM). Documentation in library files. + bacon.write(MCP4725::Normal, (0xFFF * (1.0/3.32) * 0.206 ), false); + + wait(freqf); + // Write to DAC register (not EEPROM). Documentation in library files. + bacon.write(MCP4725::Normal, (0xFFF * (1.0/3.32) * 0.115 ), false); + + wait(freqf); + // Write to DAC register (not EEPROM). Documentation in library files. + bacon.write(MCP4725::Normal, (0xFFF * (1.0/3.32) * 0.048 ), false); + + wait(freqf); + // Write to DAC register (not EEPROM). Documentation in library files. + bacon.write(MCP4725::Normal, (0xFFF * (1.0/3.32) * 0.009 ), false); + + wait(freqf); + // Write to DAC register (not EEPROM). Documentation in library files. + bacon.write(MCP4725::Normal, (0xFFF * (1.0/3.32) * 0.001 ), false); + + pc.printf("Value is %f V \r\n",analogIn.read()*3.3); + + + wait(freqf); + // Write to DAC register (not EEPROM). Documentation in library files. + bacon.write(MCP4725::Normal, (0xFFF * (1.0/3.32) * 0.024 ), false); + + wait(freqf); + // Write to DAC register (not EEPROM). Documentation in library files. + bacon.write(MCP4725::Normal, (0xFFF * (1.0/3.32) * 0.078 ), false); + + wait(freqf); + // Write to DAC register (not EEPROM). Documentation in library files. + bacon.write(MCP4725::Normal, (0xFFF * (1.0/3.32) * 0.158 ), false); + + wait(freqf); + // Write to DAC register (not EEPROM). Documentation in library files. + bacon.write(MCP4725::Normal, (0xFFF * (1.0/3.32) * 0.375 ), false); + + + testLed = 0; pc.printf("Value is %f V \r\n",analogIn.read()*3.3); wait(freqf);