Cosmic Ray Sheilding

Dependencies:   mbed SDFileSystem ExtendedTimer

main.cpp

Committer:
lwells
Date:
2019-03-21
Revision:
1:c7c64242fe4c
Parent:
0:600099ef57c8
Child:
2:2c78fc509a01

File content as of revision 1:c7c64242fe4c:

#include <mbed.h>

InterruptIn geigerDelrin(p13); //Counter Serial Number:101
InterruptIn geigerJello(p14); //Counter Serial Number:142
Serial pc (USBTX, USBRX);
Timer readPulse;

void countDelrinPulse(void); //Function called when Delrin Geiger reads pulse
void countJelloPulse(void); //Function called when Jello Geiger reads pulse

int jelloCount = 0;
int delrinCount = 0;

int main() {
  geigerDelrin.fall(&countDelrinPulse); //Geiger counter reads a hit
  geigerJello.fall(&countJelloPulse);

  readPulse.start();

  while (true){
    if (readPulse > 60){ //Displays number of counts per 15 seconds
      readPulse.reset();
      pc.printf("Delrin Count: %d \r\n", jelloCount);
      pc.printf("Jello Count: %d \r\n", delrinCount);
      jelloCount = 0;
      delrinCount = 0;
    }
  }
}