Russell Shomberg
/
shomberg_hw_3
Sawtooth program
Fork of shomberg_hw_3 by
main.cpp
- Committer:
- rshomberg
- Date:
- 2018-09-25
- Revision:
- 0:82635173a413
- Child:
- 1:cbee04784c60
File content as of revision 0:82635173a413:
/** MBED Analug Output Sawtooth main.cpp Purpose: Output a sawtooth waveform Adjust frequency using variable resistor Adjust amplitude using switch @author Russell Shomberg @version 1.0 2018-09-25 Issues: NTR */ // INCLUDES #include "mbed.h" // INPUTS DigitalIn switchPosition(p7); AnalogIn Ain(p20); // wire p20 to a variable resister connected from Vref and GND // OUTPUTS Serial pc(USBTX, USBRX); AnalogOut Aout(p18); // VARIABLES float ADCdata; int frequency; int amplitude; float i; int main() { while(1) { for (i=0;i<1;i=i+.01){ Aout = i; wait(0.001); } /* for (i=1;i>0;i=i-.01) { Aout = i; wait(0.001) } */ } }