Recent Changes - Search:

TEAMS Academy Wiki

THS

Explore TEAMS!
for visiting sophomores & juniors


Robotics


EnvBioTech

Bat Design

Assistive Tech

Students

Instructors

TEAMS Forum

TEAMS Calendar

TEAMS Web Site

Wiki Info

edit Robots.SideBar

SmallStarterPrograms

TEAMS Academy 91.110 Interactive Robotics – Introductory C programming assignments

  • Problems 1 - 3 should be done for Nov 6/7
  • Problems 4 - 5 due Nov 10/12
  • Start by making flowcharts for each process
  • Then write properly commented & formatted/indented code that you debug and test on your robot. If it doesn't work, get help & give your best effort!!
  • Have flowchart stapled to hard copy of main.c for each task ready to show us for HW check in class.
  • Have one of the programs loaded on your robot BEFORE you get to class.
  • Save each sample program in a different folder (or you will overwrite your work!!)--e.g., RhineTask1 folder, RhineTask2 folder, etc.
  • Bonus if you complete early

As soon as you finish these tasks, you can move on to the good stuff! (TEAMS Grand Prix and more!!)

Here are the task descriptions…stick to the task and don’t add any other functionality (KISS principle)!!

1. The play LED blinks on and off until the play button is pressed, then the play LED stays on. The Power LED is green always.

2. Start the robot driving and turn on the play light, Power LED = green. When the robot encounters an unsafe driving situation (you need to define “unsafe”), beep error and blink the power LED on and off (bright red). What should you do with the play light?? When the robot is in a safe state, the Power LED is on and green.

3. Start the robot driving and turn on the play light, Power LED = green. When play is pressed, the robot accelerates from current velocity up to 200 mm/sec in a reasonable manner (use a "for" loop). When advance is pressed, the robot decelerates from current velocity down to -200 mm/sec in a reasonable manner (use a "for" loop).

4. When the left bumper is pressed, play a short song and turn on left CM led. When the right bumper is pressed, turn on advance LED and right CM LED. When both are pressed, turn on both CM LEDs, but nothing else. Power LED on and green the whole time, and the advance LED should blink on & off.

Max's Song Example:
  • Feel free to cut & paste the code below into your program & modify the portions in [BLUE] ...
  • To Define Your Song: Define your song notes and song number in the global initilaization section of your program...right after the cr8_init(); line in your in your main.c file as shown in the example below...
    cr8_byte_tx(CR8_OPCODE_SONG); // Don't change anything on this line
    cr8_byte_tx( [THE NUMBER OF YOUR SONG] );
    cr8_byte_tx( [NUMBER OF NOTES IN YOUR SONG] );
    cr8_byte_tx( 72 ); //note #1 from OI chart of notes
    cr8_byte_tx( 8 ); //note length = 8/64th sec = 1/8 sec
    cr8_byte_tx( 88 ); //note #2
    cr8_byte_tx( 12 ); //note length
    // .
    // .
    // .
    // etc.
  • To play your song, put these two lines of code in your program...
    cr8_byte_tx(CR8_OPCODE_PLAY); // send opcode to play song (you could use 141 instead of "CR8_OPCODE_PLAY")
    cr8_byte_tx( [THE NUMBER OF YOUR SONG] );

5. Drive at a increasing but reasonable speed in an outward spiral (hint: use a variable for r or left-right wheel velocities and change how?). If any cliff sensor detects a large color change, reverse direction. If any bumper is hit, reduce speed by half and beep. If advance button pressed, stop and beep. Power LED green the whole time you are moving, red when you are not. When you come to a stop, blink advance LED on and off.

Edit - History - Print - Recent Changes - Search
Page last modified on November 12, 2008, at 05:42 PM