Recall the servo test setup from Day 15: the potentiometer, the ADC and the PWM pulse controlled the servo, with the code from Day15_servo_template.c that you completed, and the servo powered as in Figure 13.2.28. We took the potentiometer off the breadboard when you started Part 1 of Lab 8. Now we’ll add the photocells to the tracker arm of your servo. The arm has a shielding cup at each end (Figure 14.2.12).
The potentiometer, the ADC and the PWM pulse controlled the servo, with the code from Day15_servo_template.c that you completed. The powering has not changed: red to the regulator board’s 5 V row, brown to the ground rail, orange to D11 (PA7). The drawing does not show the potentiometer, which we took off the breadboard at the start of Part 1 of Lab 8. Now we’ll add the photocells to the tracker arm of your servo.
Figure14.2.12.A photocell in the shielding cup at one end of the tracker arm. The cup shades the cell from light arriving from the other side of the arm.
With nothing powered, remove your photocells from the breadboard, put one into each of the two shielding cups on the motor arm, and bring each lead to the breadboard with an alligator-to-breadboard clip, one clip per lead.
The cup shades its cell from light arriving from the other side of the arm. If your photocells are already in the cups, they are already wired through their clips.
With nothing powered, remove your photocells from the breadboard, put one into each of the two shielding cups on the motor arm, and bring each lead to the breadboard with an alligator-to-breadboard clip, one clip per lead. If your photocells are already in the cups, they are already wired through their clips; go on to the last step.
Connect the leads of the alligator clips to your breadboard to recreate the photocell circuit from earlier in the lab. Then power up in the usual order and run your two-channel program again: both channels print, now from the arm.
Figure14.2.15.The ultimate setup. The two photocells are drawn on the breadboard, but they are physically in the cups of your tracker arm, reached through the alligator clips. The servo is powered from the regulator board’s 5 V pin and its orange signal lead goes to D11 (PA7), as in Figure 13.2.28. The regulator board is plugged into the breadboard, so each of its pins is reached through the row it sits in.
The ultimate setup. The two photocells are drawn on the breadboard here, but they are physically in the cups of your tracker arm, reached through the alligator clips; the servo is powered from the regulator board’s 5 V pin.