Lab 3 example 2, no debugging
Fork of DACandticker_sample_with_debug by
DAC Ticker
- Sample code for part 2 of lab 3 using the DAC, called from a Ticker.
- Note that to use AnalogOut from the Ticker (an ISR), we create a version without locking.
Diff: main.cpp
- Revision:
- 2:e27fd3b65155
- Parent:
- 1:18e0f8aef32f
- Child:
- 3:2bf79a3c3cbc
--- a/main.cpp Wed Feb 01 13:53:26 2017 +0000 +++ b/main.cpp Wed Jan 24 22:56:54 2018 +0000 @@ -3,10 +3,11 @@ // Periodically write to the AnalogOut to create a sine wave // Alternate between two fixed frequencies every 5 sec // +// Updated for mbed 5 + // THIS VERSION HAS NO DEBUGGING CODE #include "mbed.h" -#include "rtos.h" #include "sineTable.h" Ticker tick ; // Creates periodic interrupt @@ -14,7 +15,7 @@ // Function called periodically // Write new value to AnalogOut -volatile int index = 0 ; // this variable is not just for debugging!! +volatile int index = 0 ; // index into array of sin values void writeAout() { ao.write_u16(sine[index]) ; index = (index + 1) % 64 ;