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 #185 background imageLoading...
Page #185 background image
Page 205
Figure 10-2.
Hank, retrofitted with a light sensor
avoid() is the highest-level behavior. It is triggered by the bumpers and does the standard back-up-and-turn.
Convincing Hank to seek light is surprisingly hard. You can, of course, implement your own algorithm in seek_enlightenment(). It's a neat feature of subsumption architecture that you can
concentrate solely on light-seeking behavior in seek_enlightenment(). The obstacle avoidance behavior is already programmed in a different behavior and will subsume the light-seeking
behavior as necessary.
Without further ado, here's the entire program, LightSeeker.c:
#include "conio.h"
#include "direct-button.h"
#include "direct-motor.h"
#include "direct-sensor.h"
#include "unistd.h"
#include "sys/tm.h"
#define MAX_TASKS 32
pid_t pid[MAX_TASKS];
int task_index;
#define BACK_TIME 500
#define TURN_TIME 800
// Motor commands.
#define COMMAND_NONE -1
#define COMMAND_FORWARD 1

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