unsigned long time1=0;
unsigned long time2=0;
boolean outHigh = false;
boolean outLow = false;
void setup() {
// put your setup code here, to run once:
pinMode(3, OUTPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
if(millis() - time1 >500) // off time
{
if(not outHigh)
{
digitalWrite(3, HIGH);
outHigh = true;
outLow = false;
time2 = millis();
}
else
{
//time1 = millis();
}
}
//Serial.println(time1);
//Serial.println(time2);
//Serial.println(micros());
if(millis() - time2 >1500) // on time
{
if(not outLow)
{
digitalWrite(3, LOW);
outLow = true;
outHigh = false;
time1 = millis();
}
else
{
//time1 = millis();
}
}
digitalWrite(5,digitalRead(10));
}