Thanks for answers people. Had a quick play last night and have a very basic code set at the moment. Was reading about the "if, else" condition. This should cover what im trying to figure at the moment fairly well. Ill upload my current very simple code below. So I now have a LED that is illuminated constant until it sees the analog input going about 500 that I want it to cut the light for x amount of seconds. I need it so that when it does see this it will send LED low for the time then go back HIGH. As it stands now when I go above it goes LOW and below it goes high but if I stay above 500 it stays off. How can I make this just go off then wait until it sees a <500 signal before allowing it to come back LOW again and do another cycle.
The reason I am after this is so you can perform "Flat out shifting" meaning the quickshifter kills ignition for what should be somewhere around 0.075 seconds just to allow the bike to drop into gear.
Any help in hugely appeciated.
Adam
<
// these constants won't change:
const int ignitionLed = 13;
const int analogPin = A0;
const int threshold = 500;
void setup() {
//initialise the led as a output:
pinMode(ignitionLed, OUTPUT);
// initialise serial communication:
Serial.begin(9600);
}
void loop() {
// read value of potentiometer:
int analogValue = analogRead(analogPin);
// if value is high enough turn led off
if (analogValue > threshold) {
digitalWrite(ignitionLed, LOW);
delay(75);
} else {
digitalWrite(ignitionLed, HIGH);
}
// print the serial comms:
Serial.println(analogValue);
delay(1);
}