|
Hi
I have an applet and i have a lego mindstorm robot, i want to move the robot
when i click on the applet's buttons can someone how i can send command
directly to RCX or post a link where i can find a usefull code?
Thx a lot.
|
|
|
In lugnet.robotics, "Matteo Core" <wipe_2097@hotmail.com> wrote:
> Hi
> I have an applet and i have a lego mindstorm robot, i want to move the robot
> when i click on the applet's buttons can someone how i can send command
> directly to RCX or post a link where i can find a usefull code?
> Thx a lot.
Not sure which language you are using, but I have done this with the Visual
Basic 6 starter pack.
In the starter pack, create a form and put a Spirit1 object on the form (from
the file Spirit1.ocx in the Lego software folders). When you put
spirit1.<command> in the VB code, using downloadable commands, the RCX will
execute the command.
A list of commands is available in the RCX Software Developers Kit, available
here:
http://mindstorms.lego.com/eng/community/resources/default.asp
Will the applet interface with VB, perhaps by having its own OCX file that could
be put on the form?
Mark
|
|
|
In lugnet.robotics, "Matteo Core" <wipe_2097@hotmail.com> wrote:
> Hi
> I have an applet and i have a lego mindstorm robot, i want to move the robot
> when i click on the applet's buttons can someone how i can send command
> directly to RCX or post a link where i can find a usefull code?
> Thx a lot.
As Mark says you can use VB to do that. Since IVPBrick COM Interface is avilable
now I think it is possible via applet as well.
Here is the sample that you can use with VB. Make sure that you add a reference
to LEGO VPBrick 2.1 type library.
If you need further help please dont hesitate to drop an Email.
Private WithEvents vpb As LEGOVPBrickLib.VPBrick
Private Sub Form_Load()
Set vpb = New LEGOVPBrickLib.VPBrick
Port$ = ""
End Sub
Private Sub FindPort()
On Error GoTo except
vpb.FindPort Port$
txtResult = "Port: " + Port$
Exit Sub
except:
txtResult = "Error " + Hex$(Err.Number) + " " + Err.Description
ErrHelp
End Sub
Private Sub OpenPort()
On Error GoTo except
vpb.Open Port$
txtResult = "Opened " + Port$
Exit Sub
except:
txtResult = "Error " + Hex$(Err.Number) + " " + Err.Description
ErrHelp
End Sub
Private Function SetBrickType(nBrickType As BrickTypes)
Select Case nBrickType
Case Scout
comboBrickType = "Scout"
vpb.BrickType = Scout
Case RCX2
comboBrickType = "RCX2"
vpb.BrickType = RCX2
Case MicroScout
comboBrickType = "MicroScout"
vpb.BrickType = MicroScout
Case Else
comboBrickType.Clear
End Select
End Function
Private Sub cmdTest_Click()
On Error GoTo except
nBrickType = vpb.Status(CheckBrickType)
SetBrickType (nBrickType)
nStatus = vpb.Status(BrickStatus) 'unlocks Scout
If nStatus = StatusReady Then
If nBrickType = Scout Then
vpb.Execute "sound 25"
Else
vpb.Execute "sound 3"
End If
txtResult = "Ok"
Else
txtResult = "Not ready"
End If
Exit Sub
except:
txtResult = "Error " + Hex$(Err.Number) + " " + Err.Description
ErrHelp
End Sub
|
|
|