Project Objectives
The objective was to build a mechanism that takes inputs from a photoresistor and outputs accordingly. The idea was to have my mechanism move forward and stop when the photoresistor detects an object in front of it.
The major challenge was that the soldered wires on the photoresistor were so heavy that the mechanism is not able to move forward effectively. I attempted to tape plywood pieces and attached another servo motor to balance the weight, but these attempts were not successful. Changes I would have made would be to use more flexible wires or a larger motor so that the mechanism can make better rotations and move forward.
The end result is that movement is still able to pause when an object is placed in front of the photoresistor.
Solidworks
Video
Code
#include <Servo.h> Servo myservo; void setup() { myservo.attach(9); pinMode(A0, INPUT); Serial.begin(9600); } void loop() { for(int i = 0; i <= 4; i++) { if (analogRead(A0) > 800) { Serial.println(analogRead(A0)); myservo.write((i*45)); delay(1000); } } }
Citations
The brace piece used to fit the photoresistor and to hold the 2 large pieces together was based off of the sample provided in the course website, rocker-example.zip
Leave a Reply
You must be logged in to post a comment.