Skip to content

Commit e8d9969

Browse files
unknownunknown
unknown
authored and
unknown
committed
Changed constant to rad vs photogate. Moved seconds counter so it wouldn't zero out. Eliminated while statement - purpose?
1 parent 4b915ca commit e8d9969

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Diff for: VernierRadiation/VernierRadiation.ino

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
/*
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.
44
55
The sketch sums the Radiation Monitor Counts in the period "CountTime".
66
The default CountTime is 1 second.
77
88
See www.vernier.com/arduino for more information.
99
*/
1010
unsigned long TimeMsStart = 0;
11-
int photogate = 2; // Pin assignment for radiation monitor
11+
int rad = 2; // Pin assignment for radiation monitor
1212
int LEDpin =13;/// line for LED to turn on when count is received.
1313
int CountTime = 1000;// this is the total time between reported results
14+
int IntervalNumber =0;// tracks how many 1 second intervals
1415

1516
void setup()
1617
{
@@ -33,16 +34,15 @@ void setup()
3334
void loop ()
3435
{
3536
int countSum = 0;
36-
int IntervalNumber =0;
37+
3738
TimeMsStart = millis();
38-
while ((millis() - TimeMsStart) <= CountTime)
39+
while ((millis() - TimeMsStart) <= CountTime)// for 1 second
3940
{
40-
if (digitalRead(photogate)==HIGH)
41+
if (digitalRead(rad)==HIGH)
4142
{
4243
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
4646
}
4747
}
4848
Serial.print(IntervalNumber);

0 commit comments

Comments
 (0)