Here is what I tried doing. I'm using an orange pip, unsure if that's single core?
This code doesn't work correctly, I dont know where to go from here
int analogInput = 0; // variable to store the analog input reading
unsigned long currentTime = 0; // variable to store the current time
unsigned long previousTime = 0; // variable to store the previous time
void setup() {
pinMode(13, OUTPUT); // set digital pin 13 as an output
Serial.begin(9600); // initialize serial communication at 9600 baud rate
}
void loop() {
previousTime = currentTime; // store the previous time
currentTime = millis(); // update the current time
analogInput = analogRead(A0); // read the analog input
// check if the analog input value increases from 0 to 255 within less than one second
if (analogInput > 0 && analogInput < 255 && (currentTime - previousTime) < 1000) {
digitalWrite(13, HIGH);
delay(200);
digitalWrite(13, LOW);
delay(200);
digitalWrite(13, HIGH);
delay(200);
digitalWrite(13, LOW);
delay(200);
digitalWrite(13, HIGH);
delay(200);
digitalWrite(13, LOW);
delay(200);
}
else
digitalWrite(13, LOW);
}
currentTime = millis(); // update the current time
analogInput = analogRead(A0); // read the analog input
// check if the analog input value increases from
// 0 to 255 within less than one second
if (analogInput == 0)
previousTime = currentTime;
if (analogInput == 1023 && (currentTime - previousTime) < 1000) {
and just in case your pot or arduino ADC is not perfect, you can give yourself a bit of wiggle room
currentTime = millis(); // update the current time
analogInput = analogRead(A0); // read the analog input
// check if the analog input value increases from
// less than 3 to more than 1020 within less than one second
if (analogInput <= 3)
previousTime = currentTime;
if (analogInput >= 1020 && (currentTime - previousTime) < 1000) {
...
}