PICAXE Newbie quickhelp

lonemangx

New Member
I am new in this microcontroller thing but I want to try this for our project in our school. To cut it short, this is my project: I want to control the tilting of blinds using different intensities of light using LDR and a servo. The blinds should also fully close at bright sunlight and at night. I also do not know what command should I use for reverse direction of the servo. Hope someone could give me a sample code for this one, and thanks in advance!
 

Brietech

Senior Member
We're typically not known for doing people's school projects for them here, but we can help =) Servos don't really have a "forward" and "reverse" mode. They usually just have a range of positions they take, going from "fully on" (225) to "fully off" (75) and everywhere in between. To use it, hook the pwm input of the servo up to an output pin, and use the "servo" command.

To output the "fully off" signal on pin 1 for instance, you would use:

"servo 1,75"
 

Rickharris

Senior Member
I would think A servo should work well if this is a model - see if you can get an old Venician blind the slats are very light You will probably use readadc to get a reading from an LDR and then servo to adjust the position of the servo and so the blind. Read through the interface manual and the basic commands and come back if you still have questions - a bit of experimentation wouldn't hurt either.
 

lonemangx

New Member
do you mean that it does not totally rotate when going to a certain position? for example the servo is in 90deg and i want it to go back to 45deg the servo would move back("reverse") to 45deg; and also if i want it to go 120deg the servo would move "forward" to 120deg. is that right?
 

tikeda

Member
Servos rotate their shafts a predetermined number of degrees depending on the duty cycle of the control pulses they receive. The longer the duty-cycle, the greater the angle that the shaft rotates in one direction (Let's assume that is in a clockwise direction). Give the servo pulses with intermediate duty cycles and the shaft rotates back about half way (about half of the maximum clockwise travel). Feed small duty cycle pulses and it rotates fully to the opposite position (fully counterclockwise).

The difference between "forward" and "reverse" travel with a servo is simply the width of the signal pulses you feed it. This is different from driving simple DC motors with which you'd have to switch the polarity of the power supplied to change direction. A couple references here and here.
 
Top