Hello all,
I've been coding odd-job projects for college and work, and I've written a fairly simple piece of code that handshakes serial data with Processing so I can test small 24v relays until they fail. I've been trying to compile the program for the Uno but I've been getting the compiling error. See my code below:
int powerinput = 3;
int poweroutput = 2;
long Timer;
long CurrentTimer;
long LastTimer;
long DelayOnTimer;
long StartTime;
long EndTime;
long DelayOffTimer;
long totalTime;
boolean failure = false;
void setup()
{
Serial.begin(9600);
pinMode(powerinput, INPUT);
pinMode(poweroutput, OUTPUT);
}
void writeData()
{
while ((failure = false) && (Serial.available() <= 0));
{
digitalWrite(poweroutput, HIGH);
int i = i + 1;
LastTimer = millis();
Timer = LastTimer;
Serial.write(i);
CurrentTimer = LastTimer;
DelayOffTimer = CurrentTimer - Timer;
digitalRead(powerinput);
if(powerinput == HIGH)
{
CurrentTimer = LastTimer;
DelayOnTimer = CurrentTimer - Timer;
Serial.write(DelayOnTimer);
if(i=1)
{
StartTime = Timer;
Serial.write(StartTime);
}
delay(1000);
digitalWrite(poweroutput, LOW);
}
else if(powerinput == LOW and DelayOffTimer > 10000)
{
failure = true;
Serial.write("failure");
EndTime = CurrentTimer;
Serial.write(CurrentTimer);
totalTime = EndTime - StartTime;
Serial.write(totalTime);
EOF;
}
}
}
Any and all help is greatly appreciated. Thank you!