Subject:
|
RE: Program VB Light Sensor RCX
|
Newsgroups:
|
lugnet.robotics
|
Date:
|
Sat, 27 Feb 1999 03:15:10 GMT
|
Viewed:
|
1092 times
|
| |
| |
Bob - Here's a VB program that does what you want. This assumes that Spirit
.ocx is named "PbrickCtrl" as in the Mindstorm SDK examples. Substitute my
statements in the "getstarted" example. I hope this helps! --- John.
Private Sub DownPrgm_Click()
'Load to program # 1 in RCX
PBrickCtrl.SelectPrgm 0
PBrickCtrl.BeginOfTask 1
'set output B for full power and forward direction
PBrickCtrl.SetPower "1", 2, 7
PBrickCtrl.SetFwd "1"
'set input 2 to read light sensor as percent
PBrickCtrl.SetSensorType 1, 3
PBrickCtrl.SetSensorMode 1, 4, 0
'start endless loop
PBrickCtrl.Loop 2, 0
'check to see if sensor value is < 50
PBrickCtrl.If 9, 1, 1, 2, 50
'if sensor value is < 50 then turn motor on
PBrickCtrl.On "1"
'if not true then turn motor off
PBrickCtrl.Else
PBrickCtrl.Off "1"
PBrickCtrl.EndIf
PBrickCtrl.EndLoop
PBrickCtrl.EndOfTask
End Sub
-----Original Message-----
From: news-gateway@lugnet.com [mailto:news-gateway@lugnet.com] On Behalf Of
Bob Fay
Sent: Friday, February 26, 1999 7:00 PM
To: lugnet.robotics@lugnet.com
Subject: Program VB Light Sensor RCX
I am struggling with learning to program the RCX with Visual Basic. I want
to have motor "B" run untill my light sensor "2" sees a level of 50. I am at
a total loss on how to write this. Is there a site where I can down load
some typical programs that I might gleen some better perspective of the
programng format? The "getstarted" program on MindStorms just is not enough
for me. Any help is appreciated.
--
Bob Fay
|
|
Message has 1 Reply: | | Re: Program VB Light Sensor RCX
|
| In article <000001be61ff$638703...@toshiba>, John Brubaker <photoman@novagate.com> writes (...) [snip rest of program] That is an excellent example to demonstrate the use of VB to load a program; once you have got that working the next thing you (...) (26 years ago, 27-Feb-99, to lugnet.robotics)
|
Message is in Reply To:
| | Program VB Light Sensor RCX
|
| I am struggling with learning to program the RCX with Visual Basic. I want to have motor "B" run untill my light sensor "2" sees a level of 50. I am at a total loss on how to write this. Is there a site where I can down load some typical programs (...) (26 years ago, 26-Feb-99, to lugnet.robotics)
|
3 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
Active threads in Robotics
|
|
|
|