|
> > temperature sensor, here is what it looks like in VB:
> >
> > type: 0 no. 0 value: 9
> > type: 0 no. 0 value: 0
> > ...
> >
> > (totally wrong values compared to what i saw with view button)
> >
> > and under nqc, the datalog looks like this:
> >
> > variable 23: 9
> > variable 23: 0
>
>
> Variables are 'type' 0, but there's a disagreement between NQC and VB
> about which var is in the log. I haven't heard of any problems with NQC
> in this respect, but I can test it out a bit and see.
But I wasn't logging variables... and I never have... I was logging sensor
values... and the values were certainly not things like 9, 0, 1, 3, ... (what
showed up for values) but were more like 16, 23, 32... (which show up 70 or so
values into the datalog, even after I take and re-take data)
> > It is as if my datalog never gets erased, but just added to, and now it
> > is a
> > huge mess. I guess I should just stick to one programming environment at
> > a
> > time.
>
> At the bytecode level, the datalog is cummulative. It only gets erased
> when you create the datalog.
But that doesn't seem to happen.
here is the program I wrote:
' Datalogging example
Option Explicit
Public Const SENSOR_1 = 0
Public Const SENSOR_3 = 2
Public Const LIGHT_TYPE = 3
Public Const TEMP_TYPE = 2
Public Const CON = 2
Public Const SENVAL = 9
Public Const TIMER = 1
Sub datalog()
With UserForm1.Spirit1
.InitComm
.BeginOfTask 0
.SetSensorType SENSOR_1, LIGHT_TYPE
.SetSensorType SENSOR_3, TEMP_TYPE
.SetDatalog 0
.SetDatalog 600
.Loop CON, 0
.DatalogNext TIMER, 0
.DatalogNext SENVAL, 0
.DatalogNext SENVAL, 2
.Wait CON, 500
.EndLoop
.EndOfTask
End With
End Sub
and here is the program i am using to upload it:
Private Sub Uploadbutton_Click()
Dim arr As Variant
Dim I As Integer
Dim from As Integer
Dim datalength As Integer
Upload.databox.Clear
from = Val(Upload.from.Text)
datalength = Val(Upload.datalength.Text)
Upload.Spirit1.InitComm
arr = Upload.Spirit1.UploadDatalog(from, datalength)
If IsArray(arr) Then
For I = LBound(arr, 2) To UBound(arr, 2)
Upload.databox.AddItem "Type: " + Str(arr(0, I)) + " No. " + Str(arr(1, I))
+ " Value: " + Str(arr(2, I))
Next I
Else
Beep
End If
End Sub
and the data that i get looks like this:
Type: 0 No. 23 Value: 9
Type: 0 No. 23 Value: 0
Type: 0 No. 23 Value: 1
Type: 0 No. 23 Value: 3
Type: 0 No. 23 Value: 128
Type: 0 No. 23 Value: 2
...
(certainly not light and temp data)
and then, if I use 70 or so as my "from" (starting point), then I can see the
data that somewhat resembles what I was actually measuring, in the VB or NQC
upload (the ROBOLAB upload for some reason only gives me the data back from a
ROBOLAB program that I had written to log light data, and it looks perfect
every time... as if there is a 'ROBOLAB' datalog and then an "everything else"
datalog)
So I guess the only real question that remains is why does my datalog not ever
get cleared???
-Ben
> Dave Baum
>
> --
> reply to: dbaum at enteract dot com
|
|
Message has 1 Reply:
Message is in Reply To:
11 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
|
|
|
|