Tuesday, May 17, 2011

Final Project: Programming

Now that we had everything put together, it was time to program. Here's where I thought we would run into major snags, but while I was building the body and pad, Juliette had pre-written the code she though would work, and all we had to do when everything was put together was plug in the amount of rotation each motor needed to do. Of course, it wasn't that simple--there were a few kinks to work out about which NXT was communicating with another, and which mailbox it was sending data to, but that was so minor compare to what I thought we were going to have to go through with the programming. Thank goodness for Juliette!
These codes are for the NXTs attached to the pads. They are the codes sending the resistance measurements to the NXTs attached to the motors. In a nutshell, it says that if the resistance reads more than 50, send that data to the NXT controlling the motor. All of theses codes are in "while" loops so that the NXTs are constantly checking the numbers they are receiving.



These programs are for the NXTs attached to the puppet. What they tell the NXT is if they receive a number over 50 in a certain mailbox, the motor associated with that mailbox rotates a certain number, pauses for a short time, and then returns to where it started.

No comments:

Post a Comment