Shop OBEX P1 Docs P2 Docs Learn Events
Boe-Bot, Receive Instructions from INI file - Help Needed — Parallax Forums

Boe-Bot, Receive Instructions from INI file - Help Needed

JimmyTheGreatJimmyTheGreat Posts: 9
edited 2008-07-18 00:43 in BASIC Stamp
I have a Parallax Boe-Bot Rev B (the one with a USB) and I would like it to do one of the following things.

1. Get instructions from a INI file. If this can be done with BASIC Stamp that would be great. If it is not possible is there any other way of reading instructions from a INI file and having the Boe-Bot follow them?

This is what the INI file will contain:

[noparse][[/noparse]Commands]
Command=0



2. Have VB.net read the INI file and then control the Boe-Bot. I would have already done this, but unfortunately I don't know how to interface with the Boe-Bot threw VB.net.



Thanks for your help.

Comments

  • FranklinFranklin Posts: 4,747
    edited 2008-07-16 15:14
    Any serial communications to the port the bot is connected to can be received by the bot and it can then act upon them. There are forum posts and N&V articles on sending serial commands to the stamp so you should be able to work this out.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • JimmyTheGreatJimmyTheGreat Posts: 9
    edited 2008-07-16 17:39
    That's not really the answer I was looking for. I have been googling for hours.
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-07-16 20:21
    Yes, the BOE-Bot can read the "programming" serial port from the PC with:

    MyValue VAR WORD

    SERIN 16, 16468, [noparse][[/noparse]DEC MyValue]

    Now, in VB.NET, you have to send "MyValue" as a string, followed by a vbCR.

    The BOE-Bot then should do an IF or something against MyValue

    IF MyValue = 0 THEN GOSUB DoZeroStuff
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2008-07-17 00:27
    Hi JimmyTheGreat, the following link discusses communication between VB Express and a Stamp and may help get you started.

    http://forums.parallax.com/showthread.php?p=671804

    Jeff T.
  • kenwtnkenwtn Posts: 250
    edited 2008-07-17 00:35
    Here is some sample code from VB express I wrote that works:
    Also attached copy of the program to receive it on the stamp

    ·· Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
    ······· Dim Cmd As Integer
    ······· Dim CmdParm As Integer
    ······· Timer2.Enabled = False
    ······· Cmd = 0
    ······· If PanChg = Yes Then
    ··········· PanChg = No
    ··········· Cmd = 2
    ··········· CmdParm = HS_PanLR.Value
    ······· End If
    ······· If TiltChg = Yes Then
    ··········· TiltChg = No
    ··········· Cmd = 1
    ··········· CmdParm = VSTiltUD.Value
    ······· End If
    ······· If TrottleChg = Yes Then
    ··········· TrottleChg = No
    ··········· Cmd = 11
    ··········· CmdParm = TrottleUD.Value + 750
    ······· End If
    ······· If HeadingChg = Yes Then
    ··········· HeadingChg = No
    ··········· Cmd = 21
    ··········· CmdParm = Heading.Value
    ······· End If
    ······· If SteeringChg = Yes Then
    ··········· SteeringChg = No
    ··········· Cmd = 31
    ··········· CmdParm = Steering.Value + 23
    ······· End If
    ······· If Cmd <> 0 Then
    ··········· SerialPort1.WriteLine("++^++" & Cmd & vbCr & Format(CmdParm, "G"))
    ······· End If
    ··· End Sub

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Keep buying replacement parts and sooner or later you will get it RIGHT!
  • JimmyTheGreatJimmyTheGreat Posts: 9
    edited 2008-07-17 03:04
    Thanks for the informative posts I did get it working with your help.

    I have attached all the code needed for someone else who might want to do this.

    Post Edited (JimmyTheGreat) : 7/17/2008 3:12:30 AM GMT
  • JimmyTheGreatJimmyTheGreat Posts: 9
    edited 2008-07-17 03:23
    I have one last question.

    I want my Boe-bot to act like a switch for connecting two wires together. Is this possible and if so how would I go about doing it? The Voltage threw the switch would not go over 5v.

    If the Basic Stamp can't do this then I will just do some mechanical action to connect the switch.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-07-17 03:43
    If you want the BoeBot to act like a switch, use a reed relay. Get one, like the 5V coil relay from RadioShack, which can be driven directly from a Stamp I/O pin (maximum current less than 20mA). You'll need a diode connected backwards (cathode to + end of relay, anode connected to - end of relay coil). You could connect one end of the relay coil to ground (with the diode anode) and the other end of the relay coil to a Stamp I/O pin (with the diode cathode) and make the I/O pin HIGH to turn the relay on.

    If you don't want to use a relay, you could (depending on what you want to switch) use a switching transistor like a 2N2222 or 2N3606 NPN transistor. You'd have to talk about what you want to turn on and off because the connections depend on what you're switching.
  • JimmyTheGreatJimmyTheGreat Posts: 9
    edited 2008-07-17 04:04
    Is this the relay your talking about? Also, I am not very familiar with hardware so what kind of diode would I need.

    If I got all this working all the coding would be is: 'HIGH pinNumber'?

    Basically I want to stimulate a mouse click. I know I could do this programmatically, but for what I need it for I cannot. The mouse could either be a USB or PS/2.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-07-17 04:30
    These diodes will work fine: www.radioshack.com/product/index.jsp?productId=2062576&cp=2032058.2032230.2032269&parentPage=family.

    The relay you found is the one I was talking about.

    Yes, all you have to do is do a HIGH pinNumber to turn the relay on and LOW pinNumber to turn it off. I suggest you turn off the relay in the initialization portion of your program.

    There are other solutions for doing this, but the reed relay is the simplest and most straightforward.
  • JimmyTheGreatJimmyTheGreat Posts: 9
    edited 2008-07-17 05:06
    Thank you very much for your help. I will be trying this out once I get the parts.
  • JimmyTheGreatJimmyTheGreat Posts: 9
    edited 2008-07-17 23:47
    I got it working.. There is only one thing wrong. When I do LOW pinNumber it closes. When I do HIGH pinNumber it opens. Open being no connection, closed be connection.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-07-18 00:02
    You probably connected one end of the relay coil to Vdd and the other end to the I/O pin.· That's the only way you could get the relay to close with a LOW and open with a HIGH.· That should work fine, but I had suggested connecting one end of the relay coil to ground (Vss) and the other end to the I/O pin.· That way, it would close with a HIGH and open with a LOW.

    Do make sure you have the diode connected properly across the relay coil with the cathode towards (+) or Vdd and the anode towards (-) or ground.· When you do a HIGH, the I/O pin gets connected internally to Vdd (+5V).· When you do a LOW, the I/O pin gets connected internally to Vss (ground).
  • JimmyTheGreatJimmyTheGreat Posts: 9
    edited 2008-07-18 00:09
    I did have one end in the Vdd.

    Which side of the diode is + or -, Im guessing the black side is -?
  • Mike GreenMike Green Posts: 23,101
    edited 2008-07-18 00:11
    There's always a band around the cathode end. That may be what you're seeing as the black side.
  • JimmyTheGreatJimmyTheGreat Posts: 9
    edited 2008-07-18 00:43
    Works wonderfully! Thanks a lot!
Sign In or Register to comment.