Bluetooth Problems

This is where you talk about the NXJ hardware related topics such as the brick, sensors, LEGO pieces, etc.

Moderators: 99jonathan, roger, imaqine

Postby CoBB » Tue Jul 31, 2007 6:28 am

I tried that too quite a few times, but I can’t get them to pair in any way. Could you post your bluetooth config files?
User avatar
CoBB
Novice
 
Posts: 73
Joined: Tue Apr 24, 2007 12:24 pm

Postby CoBB » Thu Aug 02, 2007 11:37 am

Good news! :D I got it working at last, and I needed two things to get there: reboot the computer (haven't done that for a month, and I don't really know what difference it makes) and install bluez-gnome (to run bluetooth-applet). Finally I got the PIN window instead of the error, and immediately tested some functions of nxjbrowse with success.

Now I noticed another problem: I tried to do a rapid test with BTSend/BTReceive, and the PC seems to be stuck at the dis.readInt() call. After adding extra messages to display on both sides I can see that they run their flush() successfully, but the echoed data apparently doesn't reach BTSend (perhaps only on a higher level).

Edit: I implemented a simple echo application in C which should behave the same way as BTReceive except for not multiplying the number by -1, and it turns out that I can't send individual bytes without waiting about 5 ms between each. At the same time, I don't see anything in the Java stream handling code that suggests the need for such a delay. Is this a limitation of bt_send()? Here's the loop after accepting the connection:

Code: Select all
  while (!(buttons_get() & 0x08)) {
    U8 buf[128];
    int i;

    memset(buf, 0, 128);
    bt_receive(buf);

    display_clear(0);
    display_goto_xy(0, 0);
    display_unsigned((buf[2] << 24) + (buf[3] << 16) + (buf[4] << 8) + buf[5], 0);
    display_update();   

    while (!(buttons_get() & 0x01));

    for (i = 0; i < buf[0]; i++) {
      bt_send(buf + i + 2, 1);
      systick_wait_ms(5);
    }

    while (buttons_get() & 0x01);
  }
User avatar
CoBB
Novice
 
Posts: 73
Joined: Tue Apr 24, 2007 12:24 pm

Previous

Return to NXJ Hardware

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest

more stuff