Cosmic Ray Sheilding
Dependencies: mbed SDFileSystem ExtendedTimer
main.cpp@2:2c78fc509a01, 2019-03-21 (annotated)
- Committer:
- lwells
- Date:
- Thu Mar 21 17:42:47 2019 +0000
- Revision:
- 2:2c78fc509a01
- Parent:
- 1:c7c64242fe4c
- Child:
- 3:466fdc08e0cd
Voids defined
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 | |
ccalderon22 | 0:600099ef57c8 | 8 | void countDelrinPulse(void); //Function called when Delrin Geiger reads pulse |
ccalderon22 | 0:600099ef57c8 | 9 | void countJelloPulse(void); //Function called when Jello Geiger reads pulse |
ccalderon22 | 0:600099ef57c8 | 10 | |
ccalderon22 | 0:600099ef57c8 | 11 | int jelloCount = 0; |
ccalderon22 | 0:600099ef57c8 | 12 | int delrinCount = 0; |
ccalderon22 | 0:600099ef57c8 | 13 | |
ccalderon22 | 0:600099ef57c8 | 14 | int main() { |
ccalderon22 | 0:600099ef57c8 | 15 | geigerDelrin.fall(&countDelrinPulse); //Geiger counter reads a hit |
ccalderon22 | 0:600099ef57c8 | 16 | geigerJello.fall(&countJelloPulse); |
ccalderon22 | 0:600099ef57c8 | 17 | |
ccalderon22 | 0:600099ef57c8 | 18 | readPulse.start(); |
ccalderon22 | 0:600099ef57c8 | 19 | |
ccalderon22 | 0:600099ef57c8 | 20 | while (true){ |
ccalderon22 | 0:600099ef57c8 | 21 | if (readPulse > 60){ //Displays number of counts per 15 seconds |
ccalderon22 | 0:600099ef57c8 | 22 | readPulse.reset(); |
ccalderon22 | 0:600099ef57c8 | 23 | pc.printf("Delrin Count: %d \r\n", jelloCount); |
ccalderon22 | 0:600099ef57c8 | 24 | pc.printf("Jello Count: %d \r\n", delrinCount); |
ccalderon22 | 0:600099ef57c8 | 25 | jelloCount = 0; |
ccalderon22 | 0:600099ef57c8 | 26 | delrinCount = 0; |
ccalderon22 | 0:600099ef57c8 | 27 | } |
ccalderon22 | 0:600099ef57c8 | 28 | } |
lwells | 2:2c78fc509a01 | 29 | } |
lwells | 2:2c78fc509a01 | 30 | |
lwells | 2:2c78fc509a01 | 31 | void countDelrinPulse{ |
lwells | 2:2c78fc509a01 | 32 | delrinCount++; |
lwells | 2:2c78fc509a01 | 33 | } |
lwells | 2:2c78fc509a01 | 34 | |
lwells | 2:2c78fc509a01 | 35 | void coutnJelloPulse{ |
lwells | 2:2c78fc509a01 | 36 | jelloCount++' |
ccalderon22 | 0:600099ef57c8 | 37 | } |