I am doing a project for work using the NXTBee NXT controlled by an arduino. But I'm a novice with programming. I am using ROBOTC and when I compile I am getting an error: Calling procedure 'nxtReadRawHS' with indirect levels mismatch. Parameter: 'unsigned ubyte* pData. Expression: 'incomingData'. Type: 'ubyte'. I know i need a .h library but when i try and put one in from another program it still is wrong. If anyone could help me please help. Thank you
Code starts here:
#pragma platform(NXT)
int power = 0; // Global variable for power.
int steer = 0; // Global variable for steering.
//int direc = 0; // Global variable for direciton.
void setupHighSpeedLink()
{
// Initialize port S4 to “high speed” mode.
nxtEnableHSPort();
nxtSetHSBaudRate(9600);
nxtHS_Mode = hsMsgModeMaster;
return;
}
void ReadResponse()
{
byte BytesRead[3]; // Array we’ll be reading into.
nxtReadRawHS(BytesRead[0], 3); // Read the array.
if(BytesRead[0] == '/') { // If we catch the null, read the next three things.
power = BytesRead[1]-70; // -70 is left, 70 is right
steer = BytesRead[2]-100; // -100 is Back, 100 is forward
//direc = BytesRead[3]; // “0? is forward, “1? is reverse.
}
}
Best Answer
The specific compiler error you're getting is this: You're passing
BytesRead[0]
as the first parameter tonxtReadRawHS()
, which is abyte
, but the compiler is telling you that the function expects aubyte *
(a pointer or address) in that position.Change the first argument to either
BytesRead
or&BytesRead[0]
; both of these expressions represent the address of the first byte in the array.