Demo Programs

From IPRE Wiki
Revision as of 02:20, 22 September 2008 by Doug Blank (Talk | contribs) (Robot Camera / Image Examples)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.

Avoid walls Media:avoid_walls.pyw - Moves forward until it detects something, then turns.

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.

Color Blindness Color Vision Deficiency - exploring color to grayscale conversions through color blindness.

Graphics Examples

Plot SIN Plots the SIN function from -4 to 4. Demonstrates using different coordinate systems on the GaphWin. Media:draw_sin.pyw

Ball Draws a bouncing ball. Media:draw_ball.pyw

Pong Plays a one-paddle game of Pong with gamepad. By Lisa Meeden.

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

Functions Simple script and play. Here is Abbott and Costello's Who's on first?. See notes or Myro Reference Manual on using voices.