EasyManuals Logo

LEGO MINDSTORMS Robots User Manual

LEGO MINDSTORMS Robots
226 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #140 background imageLoading...
Page #140 background image
#define FORWARD_MESSAGE 16
#define SPIN_MESSAGE 17
#define STOP_MESSAGE 18
#define GRAB_MESSAGE 19
#define RELEASE_MESSAGE 20
#define HEARTBEAT_MESSAGE 21
#define HEARTBEAT_TIME 20
task main() {
SetSensor(SENSOR_1, SENSOR_LIGHT);
SetSensor(SENSOR_2, SENSOR_TOUCH);
SetSensor(SENSOR_3, SENSOR_TOUCH);
Page 152
start lightWatcher;
start touchWatcher;
start heartbeat;
}
task touchWatcher() {
while (true) {
if (SENSOR_2 == 1) {
SendMessage (FORWARD_MESSAGE);
Wait(10);
until (SENSOR_2 == 0);
SendMessage (STOP_MESSAGE);
}
if (SENSOR_3 == 1) {
SendMessage (SPIN_MESSAGE);
Wait(10);
until (SENSOR_3 == 0);
SendMessage (STOP_MESSAGE);
}
}
}
#define TOLERANCE 3
int current;
int minimum;
int maximum;
int midline;
int lastArmMessage;
task lightWatcher() {
minimum = 100;
maximum = 0;
while (true) {
current = SENSOR_1;
if (current < minimum) minimum = current;
if (current > maximum) maximum = current;
midline = minimum + (maximum - minimum) / 2;
if (SENSOR_1 <= (midline - TOLERANCE) &&
lastArmMessage != RELEASE_MESSAGE) {

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the LEGO MINDSTORMS Robots and is the answer not in the manual?

LEGO MINDSTORMS Robots Specifications

General IconGeneral
Product LineLEGO MINDSTORMS
CategoryToy
Age Range10+
Batteries RequiredYes
Memory64 MB RAM, 16 MB Flash
ConnectivityBluetooth, USB
SensorsTouch, Color, Gyro
Battery TypeAA
Interactive FeaturesProgrammable, Remote Control
App CompatibilityiOS, Android
ProcessorARM9
Pieces Count601
Battery Count6
App NameLEGO MINDSTORMS EV3 Programmer App

Related product manuals