Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 45 lines (37 sloc) 0.853 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
//
// Geiger Counter Firmware
// CCD Curiosity Balloon Satellite Project
// Copyright 2012 Carter Allen
// Based on the work of Aaron Weiss
//

#include <TimerOne.h>

long Baud = 9600;
int LEDPin = 5; // Status LED blinks for each count
long CountTime = 1000000; // 1 second, in microseconds

volatile long counts = 0;

void incrementCount(void) {
  counts++;
  digitalWrite(LEDPin, HIGH);
}

void printCount(void) {
  noInterrupts();
  Serial.print(millis());
  Serial.print(",");
  Serial.println(counts);
  counts = 0;
  interrupts();
}

void setup() {
  Serial.begin(Baud);
  noInterrupts();
  attachInterrupt(INT0, incrementCount, FALLING);
  Timer1.initialize(CountTime);
  Timer1.attachInterrupt(printCount);
  pinMode(LEDPin, OUTPUT);
  interrupts();
  delay(6000);
}

void loop() {
  digitalWrite(LEDPin, LOW);
  delay(30);
}
Something went wrong with that request. Please try again.