LAB 3 DAC

Fork of DACandticker_sample by William Marsh

Revision:
4:dc6e0fdcf6b4
Parent:
3:1df612e3c838
--- a/main.cpp	Fri Feb 09 21:13:03 2018 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-// Lab 3 Example Program 2
-// -----------------------
-// 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 "sineTable.h"
-
-Ticker tick ;          // Creates periodic interrupt
-AnalogOut ao(PTE30) ;  // Analog output
-
-
-// Function called periodically
-// Write new value to AnalogOut 
-volatile int index = 0 ; // index into array of sin values
-void writeAout() {
-    ao.write_u16(sine[index]) ;
-    index = (index + 1) % 64 ;   
-}
-
-// Control the frequency of updates
-//   Alternative between two frequencies      
-int main() {
-    int update_us = 1000 ; // 1ms
-    while (true) {
-        tick.attach_us(callback(&writeAout), update_us); // setup ticker to write to AnalogOut
-        Thread::wait(30000) ; // wait 30 sec - 30000ms
-        update_us = 2000 ; // 2ms
-        tick.attach_us(callback(&writeAout), update_us); // setup ticker to write to AnalogOut
-        Thread::wait(30000) ; // wait 30 sec - 30000ms
-        update_us = 1000 ; // 1ms
-    }
-}