Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of muonhunter-K8 by
Diff: main.cpp
- Revision:
- 1:549e331aefab
- Parent:
- 0:52895a475820
- Child:
- 2:66a2e52ad175
--- a/main.cpp Tue Oct 04 09:34:20 2016 +0000 +++ b/main.cpp Tue Oct 04 11:21:03 2016 +0000 @@ -14,6 +14,7 @@ //set the coincidence time window in us int coincidence_wait = 150; bool mdet = 0; +bool buzzer = 0; int muon_total; int gm1_total; @@ -59,36 +60,46 @@ void muon_buzz(void){ C_led = 1; - for(int i = 0; i < 32; i++){ - Buzzer = !Buzzer; - wait(0.002); - } + + if(buzzer){ + for(int i = 0; i < 32; i++){ + Buzzer = !Buzzer; + wait(0.002); + }} else { + wait(0.05); + } + C_led = 0; } void GM1_buzz(void){ GM1_led = 1; + if(buzzer){ for(int i = 0; i < 16; i++) { Buzzer = !Buzzer; wait(0.001); - } + }} else { + wait(0.05); + } GM1_led = 0; } void GM2_buzz(void){ GM2_led = 1; + if(buzzer){ for(int i = 0; i < 16; i++) { Buzzer = !Buzzer; wait(0.001); - } + }} else { + wait(0.05); + } GM2_led = 0; } //adds a detection onto the queue void add_detection(int channel, float time){ - Detection* det; - det = new Detection(channel, time); + Detection* det = new Detection(channel, time); detections.push(*det); delete det; } @@ -172,7 +183,12 @@ //ticker to monitor memory usage memory_checker.attach(&memory_checker_, 0.1); - while(1){ + if(detections.size() > 1){ + Detection temp = detections.front(); + pc.printf("%d, %d, %f\n", detections.size(), temp.get_channel(), temp.get_time()); + detections.pop(); + } + wait(1); } } \ No newline at end of file