Thursday, July 26, 2012

Arduino 201 and Workshop 88

A few weeks ago, I started programming Arduino microcontrollers at Workshop 88 for the first time in the Arduino 101 class. Today was the second class: 201. As it turns out, I completely forgot to bring any Lego motors with me to demonstrate if things were working with the NXShield. Shame on me. However, I did have a continuous rotation servo that I hooked into the servo pin headers. We were able to use the native functionality of the Arduino's servo libraries to control the servo. This will allow robots to use both Lego Motors and Hobby Servos in their robots with the NXShield. We first started tinkering by playing around with the built in LED which flashes red, blue and green in the NXShield. After that, we decided to try getting the servo to work. 


The project actually works! The Arduino received and transmitted information to the terminal prompt on my screen. If you entered "f" for forward, the speed increased. If you entered "b" for backwards, the speed decreased. You could even get the motor rotating in both directions. If you entered anything but "f" or "b", then the motor would come to a hard stop. You You can see the code used in the video here.

We have intended motor movement!
Computer Science!
Russ and I were getting pretty into programming last night. I really enjoyed his depth of knowledge of microcontrollers. We spent at least half of the time talking about compilers and how software runs on the Arduino. Not having much formal software training beyond a few C and C++ classes, it was really cool to get the crash course in processors, compilers, and architecture. The rest of the time was more focused on the Arduino itself. If we had the time allotment to keep going, we would have landed on the topic of astrophysics. The two pictures below are from an example program which blinks the multi-color LED inside the NXShield. It continually cycled between red, green, and blue.  

Blinking LED Test
Blinking LED Test
  
Showing the Setup
Here is a closeup of the NXShield, Arduino, and Motor.

No comments:

Post a Comment