Combination Report Einstein Robot



Download 10.84 Mb.
Page30/41
Date conversion08.07.2018
Size10.84 Mb.
1   ...   26   27   28   29   30   31   32   33   ...   41

Neils Bohr Arm Wheel Bluetooth Interface Spec






Both Arm and Wheels are completely controlled by the NXT block.

Interfacing with the NXT requires 2 Bytes (Four HEX digits) sent to the NXT

The first Byte:



Decimal Hex Function

1 01 Shoulder

2 02 Arm

3 03 Elbow

4 04 Wrist_ud

5 05 Wrist_lr

6 06 Hand

7 07 Left Wheel

8 08 Right Wheel

9 09 Forward

10 0A Reverse

11 0B Left

12 0C Right

13 0D RESERVED

14 0E RESERVED

15 0F RESERVED

16-255 10-FF RESERVED
The second byte is a Signed binary with values given in percentages

• MSB (bit 7) determines forward or reverse

◦ 0 is forward

◦ 1 goes in reverse direction

• Valid values are 0 to 100 on bits 6 to 0
Servo expectations:

Shoulder – Positive is right, Negative is left

Wrist_ud – Postitive is up, Negative is down

wrist_lr – Positive is right, Negative is left

Hand – Positive is open, Negative is close
Servo transition expectations:

Shoulder – 2 seconds

Wrist_ud – 1 seconds

wrist_lr – 1 seconds


Example code:

// check size of message in mail box

nSizeOfMessage = cCmdMessageGetSize(0);

// read bluetooth mailbox and put into receive-buffer

nBTCmdRdErrorStatus = cCmdMessageRead(nRcvBuffer, nSizeOfMessage, 0); // inmail 0

ClearMessage();

int temp;

// decode Bluetooth commands and execute

switch(nRcvBuffer[0]) // decode the first byte

{

case 0x09:



nxtDisplayTextLine(3,"forward...");

temp = nRcvBuffer[1]; // decode the second byte

forward(temp); // forward at power level 25

// send response to PC if need

cCmdMessageWriteToBluetooth(nXmitBuffer, kMaxSizeOfMessage, 1);// outmail 1

break;


}

Direct command

The NXT supports direct commands to directly instruct the brick over Bluetooth such as start and stop a program loaded on NXT brick. This provides a simple way to control the brick from device other than NXT (PC/handheld...). See the implementation below in Visual Basic for details.

Also see Bluetooth development kit 'Direct command' for more information:

http://mindstorms.lego.com/en-us/support/files/default.aspx

Note: RobotC does not support sending direct commands (so that one NXT brick can control other NXT).

1   ...   26   27   28   29   30   31   32   33   ...   41


The database is protected by copyright ©dentisty.org 2016
send message

    Main page