1
1
/*
2
- VernierRadiation (v 2014.09 )
3
- Monitors a Vernier Radiation Monitor connected to BTD connector.
2
+ VernierRadiation (v 2014.12 )
3
+ Monitors a Vernier Radiation Monitor connected to BTD1 connector.
4
4
5
5
The sketch sums the Radiation Monitor Counts in the period "CountTime".
6
6
The default CountTime is 1 second.
7
7
8
8
See www.vernier.com/arduino for more information.
9
9
*/
10
10
unsigned long TimeMsStart = 0 ;
11
- int photogate = 2 ; // Pin assignment for radiation monitor
11
+ int rad = 2 ; // Pin assignment for radiation monitor
12
12
int LEDpin =13 ;// / line for LED to turn on when count is received.
13
13
int CountTime = 1000 ;// this is the total time between reported results
14
+ int IntervalNumber =0 ;// tracks how many 1 second intervals
14
15
15
16
void setup ()
16
17
{
@@ -33,16 +34,15 @@ void setup()
33
34
void loop ()
34
35
{
35
36
int countSum = 0 ;
36
- int IntervalNumber = 0 ;
37
+
37
38
TimeMsStart = millis ();
38
- while ((millis () - TimeMsStart) <= CountTime)
39
+ while ((millis () - TimeMsStart) <= CountTime)// for 1 second
39
40
{
40
- if (digitalRead (photogate )==HIGH)
41
+ if (digitalRead (rad )==HIGH)
41
42
{
42
43
digitalWrite (LEDpin, HIGH);// turn on LED
43
- countSum ++;
44
- while (digitalRead (photogate)==HIGH);
45
- digitalWrite (LEDpin, LOW); // turn off LED
44
+ countSum ++;// adds a count
45
+ digitalWrite (LEDpin, LOW); // turn off LED so it has to be forced back on
46
46
}
47
47
}
48
48
Serial.print (IntervalNumber);
0 commit comments