#include // ============================================================ // TOUCH SENSOR (Lever, Small Touch, Large Touch) // ============================================================ // Drive forward until touch sensor 0 is pressed, // then drive backward until touch sensor 1 is pressed void touch_sensor_example() { while (digital(0) == 0) { motor(0, 100); motor(3, 100); } ao(); msleep(1000); while (digital(1) == 0) { motor(0, -100); motor(3, -100); } ao(); msleep(1000); } // ============================================================ // WAIT FOR LIGHT // ============================================================ void wait_for_light_example() { wait_for_light(0); } // Wait for light with button confirmation void wait_for_light_with_button() { if (push_button() == 1) { wait_for_light(0); } } // ============================================================ // SHUT DOWN // ============================================================ // Shuts down all motors after 119 seconds (just under 2 minutes) void shutdown_example() { shut_down_in(119); }