I am trying to count the time it takes for a mass to fall. I have a switch what is opened when I release and a switch on the floor that closes when the mass hits it. The millis() value that I output for this time is huge, like: 4294966684. I don't even know what this number represents. Can someone please help me determine what is going on with this? I would think the result would be in msec. This is urgent as this assignment is due today.
My code:
unsigned long releaseTime=0;
unsigned long startTime=0;
int Boolean1=0;
const int pin11=11;
int PIN11STATE=0;
unsigned long dropTime=0;
int Boolean2=0;
const int pin9=9;
int PIN9STATE=9;
void setup() {
// put your setup code here, to run once:
pinMode(9,INPUT);
pinMode(11, INPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
PIN9STATE=digitalRead(pin9);
PIN11STATE=digitalRead(pin11);
if ((PIN11STATE==LOW)&&(Boolean1==0)){
releaseTime=millis();
Boolean1=1;
// Serial.print(releaseTime/1000);
}
if ((PIN9STATE==HIGH)&&(Boolean2==0)){
dropTime=millis();
// Serial.print(dropTime);
Serial.print((releaseTime)-(dropTime));
Boolean2=1;
}
}