Demo Programs

From IPRE Wiki

Jump to: navigation, search

Robot Examples

LightSensors Media:LightSensors.pyw - This program watches the three light sensors and performs a different action when each sensor is (fully) covered.

Escape! Media:escape.pyw - This program implements a behavior designed to escape from a room or maze.

Orient to Light Media:orient_to_light.pyw - Orients the robot towards the brightest light source it can find.

Script Executer Media:file_robot.pyw and Media:myFile.txt - Reads robot commands from a file, and executes them.

Waste Battery Media:battery.pyw - Runs the robot continuously, reporting the remaining battery voltage until the new voltage is 0.3 volts lower than the original voltage.

Behavior Media:behavior.pyw - Example of a finite state machine & functional programming (using a variable to point to a function, and changing the function bound to the variable).


Robot Camera / Image Examples

Take Pictures Media:take_pictures.pyw - Shows multiple ways to take and show 42 pictures using the robot's camera.

Create Webpage [writeWebpage.pyw] - Takes a picture with the camera, and then writes a webpage containing that picture.

Capture Movie Media:capture_movie.pyw - Captures multiple images, saves them in a list, and plays back the movie.

Drawing on an Image How to manipulate pixels and images: Media:drawLine.pyw Media:moveLine.pyw Media:scanLine.pyw

Find Red Media:findRed.pyw Find red pixels in an image, calculate the center of the red pixels, and draw a box around them.


Non-Robot Examples

Security Can you find out everything that is wrong with Media:pincode_bad.pyw and fix it? Media:pincode_improved.pyw

File I/O Media:copyFile.pyw and Media:filterFile.pyw

Sorting Media:insertionSort.pyw and Media:mergeSort.pyw


Object Oriented Programming' A simulation that uses Rabits, Foxes and Bears (subclassed from Animal) to demonstrate OOP techniques and syntax. Media:animals.pyw and a more advanced Media:animals_eating.pyw

Personal tools