I was able to get everything connected in board, however I am not being successful in making the NXT read the sensor. I am programming in NXC and so far I got this:
Code: Select all
// READ TPA81
#define TPA81_PORT IN_1
#define TPA81_ADDR 0xD0
task main()
{
SetSensorType( TPA81_PORT, IN_TYPE_LOWSPEED );
SetSensorMode( TPA81_PORT, IN_MODE_RAW );
ResetSensor( TPA81_PORT );
byte inbuf[10];
byte nByteReady = 0;
while( 1 )
{
while (I2CStatus( TPA81_PORT, nByteReady ) == STAT_COMM_PENDING);
{
}
I2CRead( TPA81_PORT, 10, inbuf );
NumOut( 0, LCD_LINE1, inbuf[3], DRAW_OPT_CLEAR_WHOLE_SCREEN );
}
}
I have no idea what this means and would be glad if anyone could tell me where I am failing.
Thanks in advance