/* Example Interactive C program for Braitenberg Vehicle 1 */ /* Global constants */ int LEFT_MOTOR = 0; /* left motor is connected to motor port 0 */ int RIGHT_MOTOR = 3; /* right motor is connected to motor port 3 */ int LEFT_TOUCH = 10; /* left touch sensor is connected to sensor port 10 */ int RIGHT_TOUCH = 12; /* right touch sensor is connected to sensor port 11 */ int LIGHT_SENSOR = 3; /* light sensor is connected to sensor port 3 */ /* Global variable */ int speed; /* the current speed of the motors */ void watch_light() { while (1) { /* change this so that the value assigned to speed depends on the current light sensor reading */ speed = 50; } } void wander() { while (1) { motor(LEFT_MOTOR, speed); motor(RIGHT_MOTOR, speed); } } void main() { /* wait for the start button before executing any further */ start_press(); /* these two processes run concurrently */ start_process(wander()); start_process(watch_light()); }