California State University, Chico Intelligent Systems Laboratory Chico, CA 95929-0410 http://www.gotbots.org

LEGO Mindstorms RIS 2.0 Programming: RCX Code

B.A. Juliano and R.S. Renner September 2004

• http://mindstorms.lego.com Robotics Invention System 2.0

• RIS Kit Contents of Kit

• RCX™ Microcomputer • CD-ROM Software • Contructopedia™ • 3 Guided Challenges • 6 Pro Challenges • USB Infrared Transmitter • 718 pieces, including (the ISL kit has more!): – 2 Motors – 2 Touch Sensors – 1 Light Sensor Light Sensor cont.

• Highly sensitive to ambient light – Sunlight is the worst • How to solve problem – Take two light sensor readings and subtract the background light • Sensitive to objects reflective surface. – Thus, difficult to measure distance. Light Sensor cont.

• Light measured as – 0% (total darkness) to – 100% (very bright). Light Sensor cont.

light energy

voltage measurement photo-transistor

light energy

voltage measurement

electrical flow Sensor Blocks

• Sensors that get outside information: – Touch sensor – Light sensor – IR sensor – Others not part of standard kit: Rotation, temperature, humidity, etc. • Sensors that get internal information – Timer sensor – Variable sensor • Sensor blocks attach to the main program block and operate concurrently to commands under the main program block Limits of RCX Code • Example 1: Program robot to distinguish dark from light that works in a variety of room conditions. • Example 2: Program robot to wander randomly, recording 50 light readings for later analysis • These tasks cannot be done with RCX Code. Alternate Firmware

• Firmware replacements: – BrickOS: open-source, /C++ based, RTOS • http://brickos.sourceforge.net/ – leJOS: open-source, Java-based • http://lejos.sourceforge.net/ – xs Lisp: Lisp-based • http://www.xslisp.com/ – pbForth: Forth-based • http://www.hempeldesigngroup.com/lego/ References

• Dean, Alice M. CS 102B: Robot Design, http://www.skidmore.edu/~adean/CS102B0409/

• InSciTE: Innovations in Science and Technology Education, www.HighTechKids.org

• LEGO.com Mindstorms Home, mindstorms.lego.com