I modified the last week assignment to have a servo motor that being controlled by a knob and an LDR that will be give
I used it to code the Arduino
For designing process, I used Fusion 360
I used it to make the graphic interface.
I used it to design the circuit and schematic
I used these Physical components:
1 Servo motor
1 Potentiometer
1 LDR sensor
Jumpers
1 Arduino Uno
1 Breadboard
Since this is similar to what I have done last week, I just remove the RGB LED and change the code a little bit so the potentiometer is controlling the servo and we are going to just show the readings from the LDR Sensor.
I used Fritzing to draw the circuit and the schematic, to make sure everything is fine. and when I tried to control the servo from the serial monitor and the GUI, I removed the potentiometer from the circuit.
This is the code without the serial monitor.
and then I rewrite the code to be controlled by the serial monitor instead of the knob, so the user is going to enter a number from 1 to 9 which will be mapping in the code to the angle value between 0 and 180 and the serial monitor will show the value of the light intensity from the LDR sensor.
part 1
part 2
part 3
and then I wrote the processing code to make a GUI to shows the intensity of the light and allows the user to turn a knob to control the angle of the servo motor from 0 to 180 degree.
part 1
part 2
part 3
so I connect the circuit the exact way that I did last week. and then started to test it.
this video shows the servo motor while being controlled by a potentiometer.
This video shows the servo motor while being controlled by the serial monitor.
This video shows the servo motor while being controlled by GUI.
at first, I tried to control the servo motor via the serial monitor by myself, but I faced some issues and the n I searched and I found this useful article.