Two new commands – COLLECT and READ LIST – allows programs to collect multiple data samples in a single command.
Use the COLLECT and READ LIST commands to:
- | Collect up to 10 samples per second |
- | From up to 4 sensors (the Digital Humidity and Temperature – DHT – sensor counts as 2 sensors) |
- | The sensors can be a mix of Vernier sensors (through TI Sensor Link) and Seeed sensors |
Note:
- | Data is collected through programs in TI-Basic |
- | Data can be saved in lists |
- | No integration with Vernier DataQuest (TI-Nspire™ CX) & EzData (TI-8x CE family) |
Command: |
COLLECT <sensor1> AND <sensor2> TIME t RATE r |
---|---|
Command Syntax: |
COLLECT <sensor1> AND <sensor2> TIME t RATE r |
Default |
Default value of for TIME: 10 seconds Default value of rate: 4 (samples/second) |
Range: |
Maximum 4 sensors Range for TIME: 1 - 100 (seconds) Range for RATE: 1 - 10 (samples per second) |
Code |
TI-Nspire™: Send "CONNECT TEMPERATURE 1 TO IN 1" Send "COLLECT TEMPERATURE 1 TIME 5 RATE 4" Wait 6 Send "READ LIST TEMPERATURE 1" Get listtemp Send "READ LIST TIME" Get listtime |
Code |
CE family: Send("COLLECT BRIGHTNESS RATE 5 TIME 5") Wait 6 Send("READ LIST BRIGHTNESS") Get(L₁) Send("READ LIST TIME") Get(L₂) Disp L₁ Disp L₂ |
Describe: |
|
Result: |
The "READ LIST TIME" command will return the sample times corresponding to the sensor sample values. Each "READ LIST" command returns a maximum of 64 data points. For collections that exceed 64 samples, the program will have to use the "READ LIST" command multiple times and combine the resulting lists. |
Type or |
This command can be used with most sensors. It cannot be used with many I2C sensors or the RV.COLORINPUT and RV.GYRO sensors built-in to TI-Innovator™ Rover. This command will work with the RV.RANGER sensor. |
For collections that exceed 64 samples, the program will have to use the “READ LIST” command multiple times and combine the resulting lists.
Example:
1. This TI-Nspire™ program will collect 10 samples per second from a temperature sensor for 10 seconds – a total of 101 samples.
Code |
Send "CONNECT TEMPERATURE 1 TO IN 1" Send "COLLECT TEMPERATURE 1 TIME 10 RATE 10" Wait 11 Send "READ LIST TEMPERATURE 1" Get readbuffer listtemp1:=readbuffer While dim(readbuffer)=64
EndWhile Send "READ LIST TIME" Get readbuffer listtime:=readbuffer While dim(readbuffer)=64
EndWhile |
The ‘Wait 0.2’ command between the ‘Send’ and the ‘Get’ commands is needed to ensure that all of the data makes it to the program before the next batch is read.
This delay is only needed on the TI-Nspire™ CX and TI-Nspire™ CX II handhelds.
2. This CE program collects 8 samples per second for 10 seconds from the built-in BRIGHTNESS sensor. The total number of samples will be 81 so the program will have to use READ LIST twice to get all the samples and then combine the lists.
Code |
Send("COLLECT BRIGHTNESS RATE 8 TIME 10") Wait 11 Send("READ LIST BRIGHTNESS") Get(L₁) Send("READ LIST BRIGHTNESS") Get(L₂) Send("READ LIST TIME") Get(L₃) Send("READ LIST TIME") Get(L₄) augment(L₁,L₂)→L₁ augment(L₃,L₄)→L₃ Disp dim(L₁) Disp dim(L₃) Disp L₁ Disp L₃ |
3. This TI-Nspire™ program collects samples from 2 sensors.
Code |
Send "CONNECT DHT1 TO IN 1" Send "CONNECT VERNIER 1 TO IN 2 AS PRESSURE" Send "COLLECT DHT 1 AND VERNIER 1 TIME 10 RATE 4" @ This will collect 41 samples for each sensor WAIT 10 Send "READ LIST DHT1 TEMPERATURE" Get list1 Send "READ LIST DHT1 HUMIDITY" Get list2 Send "READ LIST VERNIER 1" Get list3 Send "READ LIST TIME" Get list4 |
Command: |
READ COLLECT |
---|---|
Command |
READ COLLECT |
Default |
|
Range: |
|
Describe: |
|
Result: |
Returns: 0 - no active collection in progress 1 - active collection in progress |
Type or |
This command can be used with most sensors. It cannot be used with many I2C sensors or the RV.COLORINPUT and RV.GYRO sensors built-in to TI-Innovator™ Rover. This command will work with the RV.RANGER sensor. |
Note:
1. | The COLLECT command cannot be used for some RV sensors like RV.GYRO or RV.COLORINPUT. It will work with RV.RANGER |
It can be used with sensors connected to the Hub while the Hub is in TI-Innovator™ Rover.
2. | The data collection starts as soon as the command is processed. |
3. | If a READ LIST command is issued during an active collection, an error is indicated. |
4. | Other SET & READ commands can be processed while a COLLECT is in progress as long as the READ command doesn’t use a sensor that’s part of the COLLECT command. |
5. | The AVERAGING command will affect the data collected with a COLLECT command only if it is issued before the CONNECT commands. See the documentation for the AVERAGING command. |