[ Log In ]
2x36 pin header IDC

2.54 mm (0.1") Pitch Male Connector 36 pin Header

$0.75
Qty:
USB 2.0 Cable 10 Foot Type A Male to Type B Male

USB 2.0 Cable Type A Male to Type B Male - 10 FT

$4.80
Qty:
3 Foot USB Cable Type A to USB Cable Type A

USB Cable Type A Male to USB Type A Male - 3 FT

$2.65
Qty:
Type K Thermocouple Temperature Sensor

Type K Thermocouple - Temperature Sensor

$4.95
Qty:
Tumbnail: 62 oz-in NEMA 17 Stepping motors (also called stepper motor)

NEMA 17 Stepping Motor (62 oz-in 5mm single shaft)

$19.95 Out of Stock
Qty:
Image of the Atmega324p

Atmega324P

$8.50
Qty:

10K timmer potentiometer

10K Trimmer Potentiometer (Through Hole)

$0.85
Qty:
16x2 LCD (Liquid Crystal Display)

16x2 LCD (Liquid Crystal Display)

$12.50
Qty:
White prototyping breadboard with 30 tie strips and two power rails on each side.

White Prototyping Breadboard (2x30 columns of tie strips and 2x2 rows of power strips)

$7.95
Qty:

Programming: Making the Hobby Servo Turn the Horn Back and Forth using the PWM and OC1/PD5 Pin

The values are 800 (.8 ms) and 2200 (2.2 ms). These numbers can be further tweaked to turn the horn more towards its limits.

The OCR1A for the first position is moved into the while(1) never ending loop. A delay is introduced because it takes time for the servo to get to the intended position. If the delay was not used, the servo would just shake in a very small position. Also, since there is no way for the microcontroller to know the position of the servo (all of the closed loop positioning is internal within the servo) the delay allows the servo to reach the position.

Another OCR1A for the other extreme position is added after the delay. Another delay is added after this statement to give the servo time to get to this new position.

The process is repeated until the microcontroller is unplugged.

Comments and Additional Information

Have some code to share? Or additional information? Respond here:

You need to be logged in to save a response on this page. The response must be constructive, helpful, supplimentary or to correct the existing video, code or narrative content.

Description:

Code (optional):