Use accelerometer to interrupt.
Dependencies: mbed SDFileSystem
Fork of shomberg_hw_7 by
Diff: main.cpp
- Revision:
- 0:82635173a413
- Child:
- 1:cbee04784c60
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Sep 25 13:41:51 2018 +0000 @@ -0,0 +1,47 @@ +/** + 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) + } +*/ + } +}