Lego Programming and Building - PowerPoint PPT Presentation

1 / 9
About This Presentation
Title:

Lego Programming and Building

Description:

(room 1312) Program your Lego SUMO vehicle ... 19.00 - XX.XX Dinner (Docs Fikarum) The great SUMO competition. Prices. More beer and snacks ... – PowerPoint PPT presentation

Number of Views:31
Avg rating:3.0/5.0
Slides: 10
Provided by: andrease
Category:

less

Transcript and Presenter's Notes

Title: Lego Programming and Building


1
Lego Programming and Building
  • RCX Programmable microcomputer (Hitatchi
    H8/3932)
  • Sensors and actuators
  • Battery driven
  • IR-transceiver

2
Building
  • Build a SUMO-like Lego vehicle
  • Control movementby motors

3
Building
  • Build a SUMO-like Lego vehicle
  • Control movementby motors
  • Detect other vehicles by touch sensors

4
Building
  • Build a SUMO-like Lego vehicle
  • Control movementby motors
  • Detect other vehicles by touch sensors
  • Detect playing field border by light sensor

5
Competing
Table
On the table
Playing Field
Pushing is allowed
Not on the table
Remember!There can be only ONE...
6
LegOS
  • Small OS to be downloaded on the RCX unit
  • Runs on Linux and Windows 95/98/NT
  • Not a hard real-time operating system
  • Supports
  • Preemptive multitasking
  • POSIX semaphores
  • Gives access to
  • LCD-display
  • Buttons
  • IR communication
  • Motors
  • Sensors

7
LegOS System calls
  • LCD-display (5 chars)
  • void lcd_int (int i)
  • void cputs (char s)
  • RCX Button Input
  • getchar()
  • wakeup_t dkey_pressed()
  • Task Management
  • int execi(function_name)
  • wakeup_t wait_event( function_name, data)
  • Motor control
  • motor_a_dir(enum MotorDir)
  • motor_b_speed(int speed)
  • Sensors
  • TOUCH_1, TOUCH_2, TOUCH_3
  • LIGHT_1, LIGHT_2, LIGHT_3
  • void ds_activate (SENSOR)
  • Miscellaneous
  • sleep(int sec)
  • msleep(int msec)
  • random()
  • srandom(int seed)
  • long int sys_time
  • Semaphores
  • sem_wait()
  • sem_post()

8
Code Provided
  • Code for running a simple Lego vehicle
  • Four tasks (threads)
  • motor_control periodic task which controls the
    motor and takes driving commands from other tasks
  • forward_run periodic task which gives commands
    for running forward or turn
  • obstacle_handling interrupt driven task which
    detects obstacles
  • border_handling interrupt driven task which
    detects playing field border

9
Schedule
  • 16.30 - 17.00 Team selection(room
    1311) Construct your Lego SUMO vehicle
  • 17.00 - 19.00 Investigate provided code(room
    1312) Program your Lego SUMO vehicle
    Download program to RCX Drive around on
    provided table Beer and snacks available
  • 19.00 - XX.XX Dinner(Docs Fikarum) The great
    SUMO competition Prices More beer and
    snacks
Write a Comment
User Comments (0)
About PowerShow.com