Pages

Sunday, March 8, 2015

Arduinos: Day 3


Class this Friday was a continuation of working with Arduinos for our new unit: Feedback and Control. Today we learned how to use an Arduino to control the movement of a servo motor as well as another method of controlling LEDs. 

Arduinos and Servo Motors


-Using an Arduino and Sweep Program to control movement of servo motor-
Sweep is a public program that makes the motor move back and forth 180 degrees in steps of 1 degree every 15 milliseconds. As part of class today we sought to understand, and then modify this program. Our modified program, whose code can be seen below, makes the motor go from 0 to 90 degrees  in steps of 1 degree every 15 milliseconds, and then from 90 to 0 degrees  in steps of 1 degree every 15 milliseconds.





-Using an Arduino and Knob Program to control movement of servo motor-
We also learned how to use set up the Arduino so that a potentiometer could be used to control the movement of the motor. For this method we used a knob program that linked the movement of the knob on the potentiometer to that of the motor so that turning the knob 1023 degrees would result in the motor turning 180 degrees.




Arduinos and LEDs

On Friday we also learned how to use a potentiometer and the knob program to control the blink rate of an LED light. The below program is a modified version of the Knob program that links the blink rate of the LED at pin 8 to the position of the knob on the potentiometer. 

Our circuit was set up as below:



Reflection

When setting up and running an Arduino circuit, it is important to make sure that both the circuit board and code are properly set up. Today we learned a lot about troubleshooting small errors within our codes such as placement of semicolons and parenthesis, as well as the placement of wires within our breadboard. Overall we did not have any issues with controlling the movement of the motor. We did, however, need to research how map, as well as other functions in our code, worked. 

3 comments:

  1. Totally agree on the proper set up of the circuit board and code. That was one of the complications my partner and I faced when completing the assignment as it caused one of our LED lights to not blink.

    ReplyDelete
  2. I agree. Semicolons and parentheses are super important! And I like how you used two LED lights at the end.

    ReplyDelete
  3. The reflection is a great thing to consider, its nice that you wrote about that part. Your codes are well commented and it is easy to understand them!

    ReplyDelete