Charles Young's development fork. Going forward I only want to push mature code to main repository.
Fork of GEO_COUNTER_L432KC by
Diff: main.cpp
- Revision:
- 4:b17c6556cf1f
- Parent:
- 3:23b0185c7e7b
- Child:
- 5:4f90b458dbdf
--- a/main.cpp Tue Aug 28 14:29:03 2018 -0700 +++ b/main.cpp Sun Sep 02 01:42:59 2018 +0000 @@ -73,7 +73,7 @@ uint32_t Count1, Count2; // pulse counters (32-bit) char Text[40]=""; // used to send messages over the serial port uint8_t Disp_mode = 0x01, Disp_unit = 0xA0; // status of 1st row and 2nd rows of LEDs -bool Stopped = 1; // status of counting activity +bool Stopped = 0; // status of counting activity double ADC_val; // used to read ADC value // ----- Prototypes of routines (defined below the main) ------------------- @@ -149,19 +149,24 @@ void Update() { ADC_val = KEYB.read(); // read voltage from keyboard - + PC.printf("%lf\n", ADC_val); if(ADC_val<0.1) // RESET pushbutton pressed { + PC.printf("reset pushed"); Count1 = 0; // clear counters Count2 = 0; } - if((ADC_val>0.4)&&(ADC_val<0.6)) // START/STOP pushbutton pressed + if((ADC_val>0.6)&&(ADC_val<0.7)) // START/STOP pushbutton pressed + { Stopped=!Stopped; // toggle status - + PC.printf("ADC > 0.6 but < 0.7"); + } if(Stopped) { // disable interrupts on TRIG1 and TRIG2 + + PC.printf("stopped"); TRIG1.rise(NULL); TRIG2.rise(NULL); @@ -177,6 +182,8 @@ else { // Enable interrupts on rising edge of digital inputs TRIG1 & TRIG2 + + PC.printf("started"); TRIG1.rise(&Count1_up); TRIG2.rise(&Count2_up);