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 / 8473
8472  |  8474
Subject: 
visual basic simple question?
Newsgroups: 
lugnet.robotics
Date: 
Tue, 23 Nov 1999 20:06:53 GMT
Viewed: 
603 times
  
Hi All

I'm struggling with VB and spirit.ocx.
I've enclosed the VB code below, but the problem I have is that whenever I try
to poll the angle sensor, the value on the RCX resets to zero. Hence a zero
reading, even if I am turning the angle sensor.
I have a form set up that allows you to select the sensor type and the mode.
Type is set to angle and mode is set to angle.

Any ideas???

thanks

Mike

---------------------------------------
using rcxdata.bas from the sdk
---------------------------------------
'all variables must be declared
Option Explicit

Private Sub cmdExit_Click()
    'close comms and form on exit
    lego.CloseComm
    End
End Sub


Private Sub cmdPoll_Click()
    'set input 1 to type selected from combo box 1
    lego.SetSensorType SENSOR_1, cboType.ListIndex
    'return result format as selected from combo box
    lego.SetSensorMode SENSOR_1, cboMode.ListIndex, 0
    'set text box to value of sensor 1
    txtPoll.Text = lego.Poll(SENVAL, SENSOR_1)
End Sub

Private Sub cmdPoll2_Click()
    'set input 2 to type selected from combo box 2
    lego.SetSensorType SENSOR_2, cboType2.ListIndex
    'return the result format as selected from the combo box
    lego.SetSensorMode SENSOR_2, cboMode2.ListIndex, 0
    'set text box to value of sensor 2
    txtPoll2.Text = lego.Poll(SENVAL, SENSOR_2)
End Sub

Private Sub cmdPoll3_Click()
    'set input 3 to type selected from combo box 3
    lego.SetSensorType SENSOR_3, cboType3.ListIndex
    'return the result format selected from teh combo box
    lego.SetSensorMode SENSOR_3, cboMode3.ListIndex, 0
    'set text box to value of sensor 3
    txtPoll3.Text = lego.Poll(SENVAL, SENSOR_3)
End Sub

Private Sub Form_Load()
    'initialise the PC serial port
    lego.InitComm
    'display first item in the combo boxes
    cboMode.Text = cboMode.List(0)
    cboType.Text = cboType.List(0)
    cboMode2.Text = cboMode2.List(0)
    cboType2.Text = cboType2.List(0)
    cboMode3.Text = cboMode3.List(0)
    cboType3.Text = cboType3.List(0)
End Sub



Message has 2 Replies:
  Multiple legOS problems
 
What is going on? I am trying to get the legOS firmware downloaded to my RCX using the firmdl3 command, but I get erratic and varying responses from "bad ir link" to "firmdl3: delete firmware failed". Every time is different, but none of them work. (...) (25 years ago, 23-Nov-99, to lugnet.robotics)
  Re: visual basic simple question?
 
mike mcfarlane <mike.mcfarlane@virgin.net> wrote in message news:FLo2JH.GwJ@lugnet.com... (...) try (...) zero (...) mode. (...) I think your problem is that the RCX zeros the sensor when you execute the SetSensorType even if it is already that (...) (25 years ago, 23-Nov-99, to lugnet.robotics)

5 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    
Active threads in Robotics

 
Verified and Trusted Team of Hackers
10 hours ago
Custom Search

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