Cosmic Ray Sheilding
Dependencies: mbed SDFileSystem ExtendedTimer
main.cpp@0:600099ef57c8, 2019-03-21 (annotated)
- Committer:
- ccalderon22
- Date:
- Thu Mar 21 17:31:29 2019 +0000
- Revision:
- 0:600099ef57c8
- Child:
- 1:c7c64242fe4c
Ready for testing
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ccalderon22 | 0:600099ef57c8 | 1 | #include <mbed.h> |
ccalderon22 | 0:600099ef57c8 | 2 | |
ccalderon22 | 0:600099ef57c8 | 3 | InterruptIn geigerDelrin(p13); //Counter Serial Number:101 |
ccalderon22 | 0:600099ef57c8 | 4 | InterruptIn geigerJello(p14); //Counter Serial Number:142 |
ccalderon22 | 0:600099ef57c8 | 5 | Serial pc (USBTX, USBRX); |
ccalderon22 | 0:600099ef57c8 | 6 | Timer readPulse; |
ccalderon22 | 0:600099ef57c8 | 7 | bool timeToRead; |
ccalderon22 | 0:600099ef57c8 | 8 | |
ccalderon22 | 0:600099ef57c8 | 9 | void countDelrinPulse(void); //Function called when Delrin Geiger reads pulse |
ccalderon22 | 0:600099ef57c8 | 10 | void countJelloPulse(void); //Function called when Jello Geiger reads pulse |
ccalderon22 | 0:600099ef57c8 | 11 | |
ccalderon22 | 0:600099ef57c8 | 12 | int jelloCount = 0; |
ccalderon22 | 0:600099ef57c8 | 13 | int delrinCount = 0; |
ccalderon22 | 0:600099ef57c8 | 14 | |
ccalderon22 | 0:600099ef57c8 | 15 | int main() { |
ccalderon22 | 0:600099ef57c8 | 16 | geigerDelrin.fall(&countDelrinPulse); //Geiger counter reads a hit |
ccalderon22 | 0:600099ef57c8 | 17 | geigerJello.fall(&countJelloPulse); |
ccalderon22 | 0:600099ef57c8 | 18 | |
ccalderon22 | 0:600099ef57c8 | 19 | readPulse.start(); |
ccalderon22 | 0:600099ef57c8 | 20 | |
ccalderon22 | 0:600099ef57c8 | 21 | while (true){ |
ccalderon22 | 0:600099ef57c8 | 22 | if (readPulse > 60){ //Displays number of counts per 15 seconds |
ccalderon22 | 0:600099ef57c8 | 23 | readPulse.reset(); |
ccalderon22 | 0:600099ef57c8 | 24 | pc.printf("Delrin Count: %d \r\n", jelloCount); |
ccalderon22 | 0:600099ef57c8 | 25 | pc.printf("Jello Count: %d \r\n", delrinCount); |
ccalderon22 | 0:600099ef57c8 | 26 | jelloCount = 0; |
ccalderon22 | 0:600099ef57c8 | 27 | delrinCount = 0; |
ccalderon22 | 0:600099ef57c8 | 28 | } |
ccalderon22 | 0:600099ef57c8 | 29 | } |
ccalderon22 | 0:600099ef57c8 | 30 | } |