Shop OBEX P1 Docs P2 Docs Learn Events
Controlling 2 LED’s and one Servo via VB6 — Parallax Forums

Controlling 2 LED’s and one Servo via VB6

karabetkarabet Posts: 17
edited 2010-03-05 19:11 in BASIC Stamp
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

Comments

  • FranklinFranklin Posts: 4,747
    edited 2010-03-04 16:49
    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
  • karabetkarabet Posts: 17
    edited 2010-03-04 18:01
    Hi Stephen,

    i did upload the VB code

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

    Karabet
    ·
  • FranklinFranklin Posts: 4,747
    edited 2010-03-04 18:18
    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
  • karabetkarabet Posts: 17
    edited 2010-03-04 18:24
    Now I did uploaded in text format the VB code

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

    Karabet
    ·
  • karabetkarabet Posts: 17
    edited 2010-03-05 07:55
    PLEASE HELP...........

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

    Karabet
    ·
  • Jimbo30Jimbo30 Posts: 129
    edited 2010-03-05 17:51
    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)
  • karabetkarabet Posts: 17
    edited 2010-03-05 18:42
    Thanks for the advice but where I have to write this in my VB code?

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

    Karabet
    ·
  • Jimbo30Jimbo30 Posts: 129
    edited 2010-03-05 19:11
    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.
Sign In or Register to comment.