train control

I unblockt the video, i dont use utube much it seems you have to hit a publish button :astonished:
mind that the video speed is faster than real life. also i brought the speed down by pin 3 to 130
(255 = full speed in this case 12v on the motor) so it gives a much smoother impression now.

there is some Light going up here :slight_smile:

that was the part of "Variables just hold a value, not any line of code."

For reading the sensor twice...
old

void loop() {
  sensLreading = analogRead(sensL);
  sensRreading = analogRead(sensR);
  delay(50);
  sensLreading = analogRead(sensL);
  sensRreading = analogRead(sensR);

new

void loop() {
  sensLreading = analogRead(sensL);
  sensRreading = analogRead(sensL);
  delay(50);
  sensLreading = analogRead(sensR);
  sensRreading = analogRead(sensR);

See your point (i hope) but in this case, does it make a difference?.
cause i am not doing anything with "analogRead(sensL)" before i have "analogRead(sensR)".
One of them always be last read. could place the "serial.print(sensL)" between them but
its not about the print lines.
i need both value`s before any IF statement.

well its running for now, 9 of 10 times al goes right. the 10th time it does not set
ledR LOW so it stays on. makes no difference train is still going from left to right and
after 2 or 3 times the led goes on and off again.

@TomGeorge
The arch is made of plywood and a white led, no tubes just made two holes across each other and stick the LDR and LEDs in them, So there is ambient light. in darkness and full daylight the scale would be from 1024 to 0, in my case with some lamps and little daylight its 800 to 80. sufficient enough to
notice the led light is blocked as you can see in the first video.