To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 23464
23463  |  23465
Subject: 
Re: How to send commands directly to the RCX?
Newsgroups: 
lugnet.robotics
Date: 
Thu, 3 Feb 2005 22:29:01 GMT
Viewed: 
1649 times
  
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



Message is in Reply To:
  How to send commands directly to the RCX?
 
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. (19 years ago, 29-Jan-05, to lugnet.robotics)

3 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR