PDA

View Full Version : Controlling 2 LEDís and one Servo via VB6



karabet
03-04-2010, 08:22 PM
Hi,
Please i need help, I’m trying to control 2 LED’s (ON/ OFF) and one Servo but I’m having the following problem.
If turning on for example LED1 and try to turn it off it will not go off and it is the same for LED2, but if i remove the servo part (code) it will work fine.
I’m connecting LED1 to P9 and LED2 to P13 and the Servo to P0.
Please find attached the complete code
here's the VB code

PLEASE HELP...........

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Regards,

Karabet


Post Edited (karabet) : 3/5/2010 7:48:06 AM GMT

Franklin
03-05-2010, 12:49 AM
I'd start with a simple program that takes the input and outputs the values redeived. You probably are not getting what you think you are. You don't show your VB code so there is no way to know what you are sending.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen

karabet
03-05-2010, 02:01 AM
Hi Stephen,

i did upload the VB code

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Regards,

Karabet

Franklin
03-05-2010, 02:18 AM
I guess you did but it is not in human readable form as far as I can tell, or at least I can't read it. Sorry

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen

karabet
03-05-2010, 02:24 AM
Now I did uploaded in text format the VB code

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Regards,

Karabet

karabet
03-05-2010, 03:55 PM
PLEASE HELP...........

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Regards,

Karabet

Jimbo30
03-06-2010, 01:51 AM
Karabet, I am still learning VB6 and basic stamp. However, I have done a VB6 interface with a Scott Edwards Servo board. I believe you are not sending the intended data the servo needs like Sync(255), Servo# and servo position(0 - 255). I would try doing all the commands in VB and just send it to the BSII. You will probably have to re-write your PBASIC code, additionally. Use a timer and scroll bar and set both to the possible servo positions (0 - 255). This should get you on the right track.

PS. Syncbyte is just the possible positions

Private Sub Timer1_Timer()
syncbyte = 255
servo = val(textservo.text) ‘servo # OR PIN # in your case
position = VScroll.value
txtposition.text = position ‘position you intend for the servo
mscomm1.output = chr$(syncbyte) & chr$(servo) & chr$(position)

karabet
03-06-2010, 02:42 AM
Thanks for the advice but where I have to write this in my VB code?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Regards,

Karabet

Jimbo30
03-06-2010, 03:11 AM
Write that code using another timer. I see you already have a timer, but you can have multiple. Don't forget to set the interval on the timer to 255 and the Scroll value also to 255.