Implement a SD card into HW6

Dependencies:   SDFileSystem mbed

Fork of shomberg_hw_6 by Russell Shomberg

Committer:
rshomberg
Date:
Tue Sep 25 13:41:51 2018 +0000
Revision:
0:82635173a413
Child:
1:cbee04784c60
initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rshomberg 0:82635173a413 1 /**
rshomberg 0:82635173a413 2 MBED Analug Output Sawtooth
rshomberg 0:82635173a413 3 main.cpp
rshomberg 0:82635173a413 4
rshomberg 0:82635173a413 5 Purpose: Output a sawtooth waveform
rshomberg 0:82635173a413 6 Adjust frequency using variable resistor
rshomberg 0:82635173a413 7 Adjust amplitude using switch
rshomberg 0:82635173a413 8
rshomberg 0:82635173a413 9 @author Russell Shomberg
rshomberg 0:82635173a413 10 @version 1.0 2018-09-25
rshomberg 0:82635173a413 11
rshomberg 0:82635173a413 12 Issues: NTR
rshomberg 0:82635173a413 13
rshomberg 0:82635173a413 14
rshomberg 0:82635173a413 15 */
rshomberg 0:82635173a413 16
rshomberg 0:82635173a413 17 // INCLUDES
rshomberg 0:82635173a413 18 #include "mbed.h"
rshomberg 0:82635173a413 19
rshomberg 0:82635173a413 20 // INPUTS
rshomberg 0:82635173a413 21 DigitalIn switchPosition(p7);
rshomberg 0:82635173a413 22 AnalogIn Ain(p20); // wire p20 to a variable resister connected from Vref and GND
rshomberg 0:82635173a413 23
rshomberg 0:82635173a413 24 // OUTPUTS
rshomberg 0:82635173a413 25 Serial pc(USBTX, USBRX);
rshomberg 0:82635173a413 26 AnalogOut Aout(p18);
rshomberg 0:82635173a413 27
rshomberg 0:82635173a413 28 // VARIABLES
rshomberg 0:82635173a413 29 float ADCdata;
rshomberg 0:82635173a413 30 int frequency;
rshomberg 0:82635173a413 31 int amplitude;
rshomberg 0:82635173a413 32 float i;
rshomberg 0:82635173a413 33
rshomberg 0:82635173a413 34 int main() {
rshomberg 0:82635173a413 35 while(1) {
rshomberg 0:82635173a413 36 for (i=0;i<1;i=i+.01){
rshomberg 0:82635173a413 37 Aout = i;
rshomberg 0:82635173a413 38 wait(0.001);
rshomberg 0:82635173a413 39 }
rshomberg 0:82635173a413 40 /*
rshomberg 0:82635173a413 41 for (i=1;i>0;i=i-.01) {
rshomberg 0:82635173a413 42 Aout = i;
rshomberg 0:82635173a413 43 wait(0.001)
rshomberg 0:82635173a413 44 }
rshomberg 0:82635173a413 45 */
rshomberg 0:82635173a413 46 }
rshomberg 0:82635173a413 47 }