PDA

View Full Version : lil program help..



okemoabe
04-01-2010, 11:05 AM
I have designed a countdown device and have already wrote functions,·'highTone' , 'lowTone' and 'Vibrate' for it.

I need someone to sample me a BS2 coding idea·that·will make the device·to;

···--·produce 'lowTone'·from·count=1500 down to count=700 and then

·· -- make ('highTone'·+ 'Vibrate') at·count < 700.

Using IF, THEN, WHILE, FOR , NEXT, DO UNTIL·etc for PBASIC is a big problem for me as the logic ended up giving me a deadlock now.

Thanx in advance

W9GFO
04-01-2010, 01:09 PM
FOR count = 1500 to 700
GOSUB lowTone
NEXT
GOSUB highTone


or

IF count < 1501 AND count > 699 THEN
GOSUB lowTone
ELSEIF count < 700 THEN
GOSUB highTone
ENDIF



Rich H

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Simple Servo Tester, a kit from Gadget Gangster. (http://www.gadgetgangster.com/206)

Post Edited (W9GFO) : 4/1/2010 6:17:07 AM GMT

okemoabe
04-01-2010, 05:55 PM
Thanx a lot this worked, but the hardest part for me is to output 'highTone' and 'Vibrate' at the same time.

Can u show me how to run them concurrently with 'Vibrate' at count < 700...

Spiral_72
04-01-2010, 09:30 PM
okemoabe said...
Thanx a lot this worked, but the hardest part for me is to output 'highTone' and 'Vibrate' at the same time.

Can u show me how to run them concurrently with 'Vibrate' at count < 700...



What is vibrate? Is it a typical DC motor with a counterweight? Or something else?

If it's just a DC motor, you'll obviously need at least a trasnsistor or relay to drive it off one BS pin. Then you'd just turn on the pin with OUT and then gusub hightone.

The pin stays ON, while your hightone routine oscillates the speaker.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"puff"...... crap, there went another one.

okemoabe
04-02-2010, 12:48 AM
ok, understood...