Using Sensor Data in Programs

You can access sensor data from all connected sensor probes through your TI-Basic program by using this command:

RefreshProbeVars statusVar

You must first launch the Vernier DataQuest™ application, or you will receive an error.

Note: The Vernier DataQuest™ application will auto-launch when you connect a sensor or a lab cradle to the TI-Nspire™ software or handheld.

The RefreshProbeVars command will be valid only when Vernier DataQuest™ is in 'meter' mode.
statusVar is an optional parameter that indicates the status of the command. These are the statusVar values:

StatusVar Value

Status

statusVar=0

Normal (continue with the program)

statusVar=1

The Vernier DataQuest™ application is in data collection mode.

Note: The Vernier DataQuest™ application must be in meter mode for this command to work.

statusVar=2

The Vernier DataQuest™ application is not launched.

statusVar=3

The Vernier DataQuest™ application is launched, but you have not connected any probes.

Your TI-Basic program will read directly from Vernier DataQuest™ variables in the symbol table.
The meter.time variable shows the last value of the variable; it does not update automatically. If no data collection has occurred, meter.time will be 0 (zero).
Use of variable names without corresponding probes being physically attached will result in a "Variable not defined" error.

Collecting Sensor Data using RefreshProbeVars

1. Launch the Vernier DataQuest™ application.
2. Connect the sensor(s) you need to collect the data.
3. Run the program you wish to use to collect data in the calculator application.
4. Manipulate the sensors and collect the data.

Note: You may create a program to interact with the TI-Innovator™ Hub using b > Hub > Send. (See Example 2, below.) This is optional.

Example 1

Define temp()=

Prgm

© Check if system is ready

RefreshProbeVars status

If status=0 Then

Disp "ready"

For n,1,50

RefreshProbeVars status

temperature:=meter.temperature

Disp "Temperature: ",temperature

If temperature>30 Then

Disp "Too hot"

EndIf

© Wait for 1 second between samples

Wait 1

EndFor

Else

Disp "Not ready. Try again later"

EndIf

EndPrgm

Example 2 - with TI-Innovator™ Hub

Define tempwithhub()=

Prgm

© Check if system is ready

RefreshProbeVars status

If status=0 Then

Disp "ready"

For n,1,50

RefreshProbeVars status

temperature:=meter.temperature

Disp "Temperature: ",temperature

If temperature>30 Then

Disp "Too hot"

© Play a tone on the Hub

Send "SET SOUND 440 TIME 2"

EndIf

© Wait for 1 second between samples

Wait 1

EndFor

Else

Disp "Not ready. Try again later"

EndIf

EndPrgm