Circuit 3A: Servo Motors (This is Circuit #8 in SIK guide v3.3)
This is my first time working with servor motors (or actually any type of motor). To reverse the direction that the servo would turn relative to how the potentiometer turned I had to swap two values that were read by A0 (potPosition) in the map function. Instead of:
servoPosition = map(potPosition, 0,1023,20,160);
I wrote:
servoPosition = map(potPosition, 1023,0,20,160);
I also tried adding a photoresistor into the circuit in place of the potentiometer. This was pretty easy to do. I had to play around with the new potPosition range since the ambient lighting sensed by the photoresistor had a much narrower resistance range so the voltage read back was ranging from around 370 to 810 instead of 0 to 1023.
Servo Project:
Servo Project with photoresistor:
The Landing is a social site for Athabasca University staff, students and invited guests. It is a space where they can share, communicate and connect with anyone or everyone.
Unless you are logged in, you will only be able to see the fraction of posts on the site that have been made public. Right now you are not logged in.
If you have an Athabasca University login ID, use your standard username and password to access this site.
We welcome comments on public posts from members of the public. Please note, however, that all comments made on public posts must be moderated by their owners before they become visible on the site. The owner of the post (and no one else) has to do that.
If you want the full range of features and you have a login ID, log in using the links at the top of the page or at https://landing.athabascau.ca/login (logins are secure and encrypted)
Posts made here are the responsibility of their owners and may not reflect the views of Athabasca University.