Function Generator and Oscilloscope
Dependencies: C12832_lcd DebounceIn mbed
Revision 4:7340e7a6eb14, committed 2014-06-03
- Comitter:
- trichards1138
- Date:
- Tue Jun 03 04:33:58 2014 +0000
- Parent:
- 3:920cc6573be0
- Commit message:
- final final
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 920cc6573be0 -r 7340e7a6eb14 main.cpp --- a/main.cpp Fri May 30 04:07:27 2014 +0000 +++ b/main.cpp Tue Jun 03 04:33:58 2014 +0000 @@ -15,7 +15,8 @@ #include "mbed.h" #include "C12832_lcd.h" -Serial pc(USBTX, USBRX); +//Serial output for debug +//Serial pc(USBTX, USBRX); C12832_LCD LCD; AnalogIn Ain(p17); AnalogOut Aout(p18); @@ -187,7 +188,8 @@ void sawTooth(void) { static double height = 1.0, inc; - static int width = 200, i; + static int width = 6000, i; + inc = height/width; check_update( SAW, &height, &width, 1.0, 10000, true ); while(!OnOff) { // thread loop check_update( 0, &height, &width, 1.0, 100000, false ); @@ -222,7 +224,7 @@ //booleans to select waveform bool do_sine=false, do_saw=false; bool do_dc=false, do_square=false; - pc.baud(19200); //debug + //pc.baud(19200); //debug banner(); //put the selection banner on LCD while(1) { if( up ) { //is UP pressed? @@ -254,23 +256,23 @@ while( OnOff ) //ensure we only get in here once first = false; //sync signal if( do_saw ) { - pc.printf("I'm doing saw\r\n"); + //pc.printf("I'm doing saw\r\n"); sawTooth(); } else if( do_dc ) { - pc.printf("I'm doing dc\r\n"); + //pc.printf("I'm doing dc\r\n"); flatdc(); } else if( do_square ) { - pc.printf("I'm doing square\r\n"); + //pc.printf("I'm doing square\r\n"); squareWave(); } else if( do_sine ) { - pc.printf("I'm doing sine\r\n"); + //pc.printf("I'm doing sine\r\n"); sineWave(); } - else { - pc.printf("I'm doing default (sine)\r\n"); + else { //Default if no button pushed + //pc.printf("I'm doing default (sine)\r\n"); sineWave(); } banner(); //we came back, ask user what next