1 / 14

Robot C

Robot C. Ready, SET, Go! Workshop SDSU, Fall 2013. Programming is Fun!. Tell the Robot exactly what to do & watch it run. Be Specific! Use Loops to repeat statements. Put several actions together to make a dance! Put several Robots together and watch the patterns. How Specific?.

saber
Download Presentation

Robot C

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Robot C Ready, SET, Go! Workshop SDSU, Fall 2013

  2. Programming is Fun! • Tell the Robot exactly what to do & watch it run. • Be Specific! • Use Loops to repeat statements. • Put several actions together to make a dance! • Put several Robots together and watch the patterns

  3. How Specific? • Robots aren’t very smart … not nearly as smart as people. • … be VERY specific. • Direct someone to enter a room and sit down.

  4. The ‘C’ Programming Language • Used for many low-level applications. • Is a ‘compiled’ language. • Compile for a specific Operating System, then run the program on computers using that OS. • Function named ‘main’ is first to run. • main is the ‘boss’. It’s statements happen in order when you run the program. • main tells other functions when to run.

  5. Robot C • Robot C is a version of the C programming language. • We’ll use Robot C to program LEGO’s MindstormsRobots

  6. Simple Moves • Download the SimpleMoves.c file and save it on your desktop. • Start ROBOTC • File / Open & Compile / Browse to the desktop and open SimpleMoves.c • Check out the code • The comments (in green) explain what’s happening • The statements (in blue & red) tell the robot what to do

  7. Is your Robot ready to roll? • Connect the battery pack and wheel motor cables (pages 19-23). • Turn your Robot on with the orange button. • Connect your Robot to your Computer with the USB cable. • In ROBOTC, choose Robot/Compile and Download Program. • Change the Refresh setting in the debug pop-up box from ‘continuous’ to ‘paused’. • Unplug your Robot from the Computer and set it on the FLOOR! • Use the Orange button and arrow keys to find your program and run it.

  8. Test & Debug • Change the commands in your program and repeat the steps to download and test the revised program: • Connect your Robot to your Computer with the USB cable. • In ROBOTC, choose Robot/Compile and Download Program. • Change the Refresh setting in the debug pop-up box from ‘continuous’ to ‘paused’. • Unplug your Robot from the Computer and set it on the FLOOR! • Use the Orange button and arrow keys to find your program and run it. • See if you can finish the program and get your Robot to move forward and backward and turn left and right.

  9. Functions • Download the Functions.c file and save it on your desktop. • Start ROBOTC • File / Open & Compile / Browse to the desktop and open Functions.c • Check out the code • The comments (in green) explain what’s happening • The statements (in blue & red) tell the robot what to do • How many functions are there? • What does each function do?

  10. Functions - too • Call the functions from main as many times as you want to move your Robot in a pattern. (You choose the pattern.) • Can we use just one function for spin left and spin right?

  11. Loops • Download the Loops.c file and save it on your desktop. • Start ROBOTC • File / Open & Compile / Browse to the desktop and open Functions.c • Check out the code • The comments (in green) explain what’s happening • The statements (in blue & red) tell the robot what to do • Can you find the loop? • How many times does it repeat? • How does it know when to stop?

  12. Loops - too • Can you put a loop into your functions program to repeat some function calls? • Can you use several loops to repeat different groups of function calls different numbers of times?

  13. Let’s Dance • Can you make a dance? • Can you work with another team to have your robots do the same dance? • Can you work with several teams to do a group dance? • Can you make 2 robots dance together? (One moves forward, the other moves back, etc.)

  14. Clean Up • Put the Robots and Books back. • Remove the cables and battery pack and put the pieces in the tray. • Plug the battery packs in to re-charge. • THANK YOU!!! • HOPE YOU HAD FUN!!!    

More Related