0

Line Robot - Basic lessons - Pushbutton switch

ML-R 8x8 bicolor display, CAN Bus,UART, 4 switches (mrm-8x8a) features 4 pushbutton switches. Reading a switch, ie. determining if it pressed or not, is easy:
void RobotLine::loop() {
	if (button(0))
		print("On\n\r");
	else
		print("Off\n\r");
}
All the instructions have forms we already met. Here we read switch 0. There are 4 switches, therefore they have numbers 0, 1, 2, or 3.

Task: start robot.

After pushing switch 3, the robot should start going straight ahead.