1

I am trying to control NXT robot using Arduino UNO and bluetooth, I used this code

 #include <SoftwareSerial.h>

byte moveTelegram [] = {0x0C,0x00,0x80,0x04,0x01,0x32,0x05,0x01,0x00,0x20,0x00,0x00,0x00,0x00};

SoftwareSerial blue(10, 11); 
int BluetoothData; 

void setup() 
{ 
    blue.begin(9600);
} 

void loop() 
{ 
     blue.write(moveTelegram,sizeof(moveTelegram));
     delay(100);

     BluetoothData=blue.read();

     delay(2000);
}

My problem is , I have to send data from NXT to Arduino, and then the NXT start moving (if I add blue.read() to my code).

How to make the NXT execute the commands directly?

Thanks,

1 Answers1

0

execute the commands directly?

I don't know what's that telegram you pasted, but that must be a kind of protocol defined by your own, so there's no way in NXT side to execute directly, you have to manually resolve that BYTES in NXT side, and then mapping to related NXT control command.

There's a existing official protocol in NXT which called Lego NXT communication protocol, since you're using Arduino, then you lost the convenient to directly call it, and you have read some official doc to assemble these BYTES, but in NXT side, If you're using the leJOS(or the official firmware), this protocol was build in supported, try google, there're lots of post.

Shawn
  • 702
  • 1
  • 9
  • 36
  • This is the NXT commands and it execute directly using any other bluetooth device, I already solved the problem by using bluetooth as master instead of slave. – Ali Almahari Apr 21 '14 at 02:46