How to keep signal as On
function:
Sensor sense object and Sensorvalue<100
Motor move backward for 10 sec (continue moving although Sensor did not sense object and go more than 100)
I am stuck can help me or hint to how to start
int motorright= 2;
int motorleft= 3;
int Sensor = A1;
float Sensorvalue;
unsigned time;
void setup()
{
pinMode(motorright,OUTPUT);
pinMode(motorleft,OUTPUT);
pinMode(Sensor,INPUT);
}
void loop()
{
int Sensorvalue = analogRead(Sensor);
if (Sensorvalue <=100) // there is object
{
digitalwrite(motorright, HIGH);
digitalwrite(motorleft, HIGH);
}