NXT_LSGetStatus
Gets the number of available bytes for digital low speed sensors (I2C)
Contents
Syntax
[BytesReady status] = NXT_LSGetStatus(port)
[BytesReady status] = NXT_LSGetStatus(port, handle)
Description
[BytesReady status] = NXT_LSGetStatus(port) gets the number of available bytes from the low speed (digital) sensor reading of the given sensor port. The value port can be addressed by the symbolic constants SENSOR_1, SENSOR_2, SENSOR_3 and SENSOR_4 analog to the labeling on the NXT Brick. The return value BytesReady contains the number of bytes available to read. status indicates if an error occures by the packet transmission. Function checkStatusBytes is interpreting this information per default.
[BytesReady status] = NXT_LSGetStatus(port, handle) uses the given Bluetooth connection handle. This should be a serial handle on a PC system and a file handle on a Linux system.
If no Bluetooth handle is specified the default one (COM_GetDefaultNXT) is used.
For more details see the official LEGO Mindstorms communication protocol.
Note:
This function's status byte sometimes contains an error message: "Pending communication transaction in progress". This is by design (see documentation of NXTCommLSCheckStatus on page 70 of the "LEGO Mindstorms NXT Executable File Specification" document).
Before using LS commands, the sensor mode has to be set to LOWSPEED_9V using the NXT_SetInputMode command.
Examples
[BytesReady status] = NXT_LSGetStatus(SENSOR_3);
handle = COM_OpenNXT('bluetooth.ini'); NXT_SetInputMode(SENSOR_1, 'LOWSPEED_9V', 'RAWMODE', 'dontreply'); % note that status can contain errorsmessages, use checkStatusByte [BytesReady status] = NXT_LSGetStatus(SENSOR_1, handle);
See also
NXT_SetInputMode, checkStatusByte, NXT_LSWrite, NXT_LSRead,
Signature
- Author: Linus Atorf (see AUTHORS)
- Date: 2007/10/15
- Copyright: 2007-2010, RWTH Aachen University