First laboratory uses each of the five routines with your modifications. These routines illustrate digital output, PWM output, and Analog input and output.
Diff: main.cpp
- Revision:
- 69:9c1bb616a393
- Parent:
- 68:61bde79fc489
- Child:
- 70:6699d1be31ca
--- a/main.cpp Mon Oct 01 01:51:02 2018 +0000 +++ b/main.cpp Mon Oct 01 11:38:41 2018 +0000 @@ -4,7 +4,7 @@ // /* to // and */ to // to make a program active // PROGRAM #1 -// +/* // This controls two digital out lines connected to LEDs // and two others that go outon pins 21 and 22 // The program alternates these lines with a 2 second delay; @@ -25,7 +25,7 @@ wait(2.); // wait 2 seconds. Use wait_ms or wait_us using integers of milli or micro seconds } } -// +*/ // PROGRAM #2 /* @@ -82,4 +82,21 @@ } } } -*/ \ No newline at end of file +*/ + + + +// PROGRAM #5 + +// This program reads an analog voltage and +// echoes it outon the analog output line +AnalogOut aout(p18); +AnalogIn ain(p20); +float volts; +float VCC = 3.292; +int main(void){ + while(1){ + volts = VCC*ain; + aout = volts/VCC; + } + }