Ardu’s Lab

Step through everyday stories in code. The yellow glow shows the line Ardu is running right now; faded lines are skipped.

The night light decides by itself

Drag the sky from day to night. Change the threshold and watch which part of the if statement runs.

reading = 200
LED is OFF

In our sensor, darker means a bigger number, from 0 (bright sun) to 1023 (pitch black).

Try “less than”. Is that a good night light?

sketch.ino

Three choices with if, else if, else

Drive the car towards the wall. Ardu checks the questions in order and runs the first one that is true.

sketch.ino

Predict the robot

Read the code, then choose what Ardu will do. Ten rounds. Watch out for tricky ones like 30 > 30!

int score = 0;

robot.ino

Choose an answer to see which line runs.