- EIFF 2019: ANIARA is a Deeply Haunting Sci-Fi Experience [Review]
- Darkstar Pictures Announces Free Online Film Festival!
- Stunning First Look at Indie Fantasy THE WANTING MARE [Trailer]
- Stunning First Look at Indie Fantasy THE WANTING MARE [Trailer]
- Stunning First Look at Indie Fantasy THE WANTING MARE [Trailer]
- SKYLINES Is Coming! [Poster Premiere]
- Who Hunts Who in HUNTER HUNTER? [Trailer]
- MONSTER HUNTER Coming for Christmas [Trailer]
- Saskatoon Fantastic Film Festival Returns with In-Person Event [Line Up]
- LUNATIQUE Director Returns with WASTELAND 3 Promo [Short Film]
- Re: Occupation, Australian Sci Fi movie
- Slice of Life, Blade Runner inspired short
- Is Snowpeircer a sequel to Willy Wonka?
- Re: Yesterday
- Re: Yesterday
- Yesterday
- Re: White Night (or where do I get my 30 + from now?)
- Re: White Night (or where do I get my 30 + from now?)
- Re: White Night (or where do I get my 30 + from now?)
- Re: White Night (or where do I get my 30 + from now?)
- BERLINALE 2021: TIDES Comes After Hell [Trailer]
- LUNATIQUE Director Returns with WASTELAND 3 Promo [Short Film]
- A Comet Destoys Earth in GREENLAND Trailer
- Interactive WAR OF THE WORLDS Adaptation Out Now!
- 8K Trailer for Train to Busan Sequel PENINSULA Drops Hard!
- Making a Bomb Shelter in a Funhouse is a Bad Idea in IMPACT EVENT [Trailer]
- Retro Slave: FOX's Post-Apocalyptic Sitcom WOOPS!
- TRAIN TO BUSAN Sequel PENINSULA Gets a Teaser Trailer
- New on Blu-ray and DVD for March 11, 2020
- The Apocalypse Kills Women in ONLY [Trailer]
- Trailer for TheWalking Dead: World Beyond Spin-Off Series
- SATOR is a Welcome Addition to the Folk Horror Canon [Review]
- Women in Horror Month: NEAR DARK
- SOUTHLAND TALES: The Cannes Cut [Review]
- A Woman's Mind Unravels in BIGHT HILL ROAD [Review]
- TIFF 2020: Vanlife Gets a Reality Check in NOMADLAND [Review]
- TIFF 2020: APPLES, THE WAY I SEE IT, PIECES OF A WOMAN & ONE NIGHT IN MIAMI [Capsule Reviews]
- TIFF 2020: The Truth Tellers Return with THE NEW CORPORATION: THE UNFORTUNATELY NECESSARY SEQUEL [Review]
- TIFF 2020: NEW ORDER is Brutal, Violent & a Must-See [Review]
- TIFF 2020: ENEMIES OF THE STATE, Or Are They? [Review]
- TIFF 2020: HOLLER Explores Life in a Dying Town [Review]
- 2067 Director Talks Inspiration, Environment & Time Travel [Interview]
- THE STRANGERS Director Returns with THE DARK AND THE WICKED [Trailer]
- Michael Shannon is Crime Boss in ECHO BOOMERS [Trailer]
- Hair Extensions Get Horrific in BAD HAIR [Trailer]
- TIFF 2020: Vanlife Gets a Reality Check in NOMADLAND [Review]
- VIFF 2020: Sobriety, Reintegration & Telekinesis Come Together in THE CURSE OF WILLOW SONG [Interview]
- VIFF 2020: Revenge Thriller Re-Examined in VIOLATION [Interview]
- VIFF2020: Director Loretta Todd on the Making of Her Debut Feature MONKEY BEACH [Interview]
- TIFF 2020: APPLES, THE WAY I SEE IT, PIECES OF A WOMAN & ONE NIGHT IN MIAMI [Capsule Reviews]
- TIFF 2020: The Truth Tellers Return with THE NEW CORPORATION: THE UNFORTUNATELY NECESSARY SEQUEL [Review]
- TIFF 2020: NEW ORDER is Brutal, Violent & a Must-See [Review]
- TIFF 2020: ENEMIES OF THE STATE, Or Are They? [Review]
- NO ESCAPE Director Talks Influencers, Escape Rooms & Writing [Interview]
- TIFF 2020: HOLLER Explores Life in a Dying Town [Review]
- The Funny Side of Alien Invasions: You have to SAVE YOURSELVES! [Trailer]
- Kodi Smit-McPhee Goes to the Future to Save the Present in 2067 [Trailer]
- First Look at Denis Villeneuve's DUNE [Trailer]
- Fantasia 2020: LAPSIS, THE COLUMNIST, MINOR PREMISE, FEELS GOOD MAN & HAIL TO THE DEADITES [Capsule Reviews]
- BUNRAKU Writer/Director Returns with LX 2048 [Trailer]
- BLOOD QUANTUM Writer/Director Talks Inspiration, Zombies & Representation [Interview]
Jack In
Latest Comments
Latest Forum Posts
PA News
Latest Reviews
Older News
Crew
Marina Antunes
Editor in Chief
Vancouver, British Columbia
Christopher Webster
Managing Editor
Edmonton, Alberta
DN aka quietearth
Founder / Asst. Managing Editor
Denver, Colorado
Simon Read
UK Correspondent
Edinburgh, Scotland
Rick McGrath
Toronto Correspondent
Toronto, Ontario
Manuel de Layet
France Correspondent
Paris, France
rochefort
Austin Correspondent
Austin, Texas
Daniel Olmos
Corrispondente in Italia
Italy
Griffith Maloney aka Griffith Maloney
New York Correspondent
New York, NY
Stephanie O
Floating Correspondent
Quiet Earth Bunker
Jason Widgington
Montreal Correspondent
Montreal, Quebec
Carlos Prime
Austin Correspondent
Austin, TX
This is the first release of my library which is specifically aimed at linux (and un*x) systems for bluetooth control. Not all functions have been tested, and in fact I don't know what all the functions do (like poll_command). I also have some problems like how to switch the ultrasonic sensor to cm. So let me know where I'm wrong, what can be fixed, what feature requests you would like, etc..
You might probably notice some calls like draw_pixel are pretty slow, this is because for all calls I have "reply required" turned on. In the next release I will add a function to turn off reply required for all non-necessary functions.
NOTE: You MUST have already paired with the NXT brick from the device you will e using the library with. It does not do the secret pin transaction.
Also I must give credit to Michael Collins, whose ultrasonic and other code from his LEGO::NXT perl module I looked at while writing this.
Here is the API.
If you get an "undefined reference to round" add -lm.
I forgot, you must compile with "-lm -lbluetooth -lnxtlibc"
And the source code is available from: http://sourceforge.net/project/showfiles.php?group_id=192706

R Delgado (13 years ago) Reply
Hi!
I am just trying to use your library and a I getting the following error when compiling test.c:
/usr/local/lib/libnxtlibc.so: undefined reference to `round'
Is the round function created by you or is
it defined somewhere else?
I'am looking forward for this library cause
I really want to control my NXT from Linux.
Thanks

R Delgado (13 years ago) Reply
Hi Again!
I've just solved the problem. I forgot to include -lm in gcc.
Now, it seems that the program connects to BT but now I get the following when running:
rfcomm connection to XX:XX:XX:XX:XX:XX good.
nonblock failed: : Bad file descriptor
Failed to initialize bluetooth
Do you know what does that means?
Do you know what could be going on?
Thanks Again!

quietearth (13 years ago) Reply
Hey sorry I should have mentioned, you must have already paired with the nxt brick from the device you are using. In linux, "hcitool cc XX:XX...." should work.

Erik (13 years ago) Reply
I keep on having trouble. I cannot get them the pair correctly... anyone else having this same problem?

ErikDeBruijn (13 years ago) Reply
Hi, I finally got it working. I can now read some simple things (firmware version, battery level) from the NXT. Thanks for the library so far. I have some suggestions. I'm not experienced in C or C++. I saw that I couldn't use the program from C++ without adding extern "C" { #include "nxtlibc.h"
} around it. This may seem a trivial thing, but it was a full day of searching and asking around for me. Perhaps others also want to use it in C++ software. I propose that you add this to the top of the header file:
#ifdef __cplusplus
extern "C" {
#endif
and at the bottom:
#ifdef __cplusplus
}
#endif
Source: http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html#faq-32.4
Thanks again for this lib! Keep up the good work!

R Delgado (13 years ago) Reply
Hi!
I still can't make it work.
I keep receiving the:
rfcomm connection to XX:XX:XX:XX:XX:XX good.
nonblock failed: : Bad file descriptor
Failed to initialize bluetooth
message. I use de hcitool command and it seems to connect but then I get the same error message.
Any suggestions?
Thanks!

quietearth (13 years ago) Reply
You have to get it to pair with the nxt brick using a pin. Try restarting your bluetooth daemons and re-running the hcitool cc XX.... You might need to do this a few times.

ErikDeBruijn (13 years ago) Reply
Hi,
I'm building a generic real-time image recognition system that constructs a 3d model of the Lego robot and its world. I wanted to fully control the robot from the same C++/C code as the rest was (also because URBI only runs on windows and I can't connect to a windows box, even with the Windows Firewall turned completely off). Windows lacks the transparency for me (I can't look at the code when I get stuck).
For reading variables, generating beeps the library works fine.
How could I control the servos? Right now I must start a program from each thing I want to do (such as a-up, b-down10).
I tried creating a servoMove C++ function that calls _set_output_state(), but this takes so many parameters that I can hardly make something out of it. When I enter values that I expect that they should do something, I get no behavior out of the servos. It also returns a TRUE, suggesting no (reported) error. Running just the beeper also works (so it seems to be specific to servo control).
The enumerations/defines such as MOTOR_ON are not available in the function I'm programming. Can I use 0x00 instead for the first one, and e.g. 0x10 for the third?
I'll post my function when it works. You may then add it to the nxtlibc package.

quietearth (13 years ago) Reply
Of course you can use the values in place of the #defines if they are not available, and I'm sorry I don't have more explanation for motor states, this is all the bluetooth api specifies. I wrote this before actually making a robot (which I should be doing soon) and I would be glad to incorporate any new functions (macros) for motor functions you come up with in next releases, as I also plan to do the same when I get around to actually building something.

ErikDeBruijn (13 years ago) Reply
After a reinstall of Kubuntu I had mayor difficulties (again) with getting pairing right... Last time it was difficult and now the tricks I learned (starting the bluetooth-applet from gnome) was not enough.
I did the following:
dbus-send --system --type=method_call --print-reply --dest=org.bluez /org/bluez/hci0 org.bluez.Adapter.RemoveBonding string:00:16:53:02:xx:xx
dbus-send --system --type=method_call --print-reply --dest=org.bluez /org/bluez/hci0 org.bluez.Adapter.CreateBonding string:00:16:53:02:xx:xx
After that I had to click the bt-applet icon in the system tray.

juan (13 years ago) Reply
Hi!
I am just trying to use your library and a I getting the following error when execute test
./test: error while loading shared libraries: libnxtlibc.so: cannot open shared object file: No such file or directory
I work in ubuntu
Help!

quietearth (13 years ago) Reply
Hey Juan, you need to set your LD_LIBRARY_PATH variable to include the dirfectory where libnxtlibc.so is.. then it will be able to find it.

juan (13 years ago) Reply
Thank you very much quietearth!!
this library is sensational

Jonathan (13 years ago) Reply
Hey i'm having a problem when i launch test :
./test: error while loading shared libraries: libbluetooth.so.1: cannot open shared object file: No such file or directory

Elkin (13 years ago) Reply
i have this problem:
rfcomm connection to XX:XX:XX:XX:XX:XX good.
nonblock failed: : Bad file descriptor
Failed to initialize bluetooth
?????

Nacho (13 years ago) Reply
I also get the error :
rfcomm connection to XX:XX:XX:XX:XX:XX good.
nonblock failed: : Bad file descriptor
Failed to initialize bluetooth
I fixed it adding :
s = nxtsock;
on bluetooth.c:219 and recompiling the library.
Thanks for this library.

Radek (12 years ago) Reply
Hi.
Jonathan, i´m having de same problem:
./test: error while loading shared libraries: libbluetooth.so.1: cannot open shared object file: No such file or directory
Someone can help us?

Anonymous (12 years ago) Reply
Hi, I've downloaded the library and I've compiled it with "make all". But while trying to compile test.c (gcc test.c -o test -lm -lbluetooth -lnxtlibc) I get this:
jorcoval@jorcoval-laptop:~/Desktop/nxtlibc-0.1$ gcc test.c -o test -lm -lbluetooth -lnxtlibc
/usr/bin/ld: can't find -lnxtlibc
collect2: ld devolvió el estado de salida 1
Any solutions?

quietearth (12 years ago) Reply
see the post on LD_LIBRARY_PATH

Radek (12 years ago) Reply
I have this problem:
rfcomm connection to XX:XX:XX:XX:XX:XX good.
nonblock failed: : Bad file descriptor
Failed to initialize bluetooth
Itry solve it adding:
s = nxtsock;
on bluetooth.c:219 and recompiling the library, but it dont fixed the problem.
How can I fixed it?

Conor (12 years ago) Reply
This appears to be exactly what I'm looking for, I hope. What firmware does the brick need to have for this to work? Lejos + bluetooth = disaster.

Manolo (12 years ago) Reply
Hi! This library is great!
But, i have an issue. I need read accelerometer values. From HiThechnic data sheet, says that register for the accelerometer starts at 40H and ends in 47H. My question is: there are a way to read that memory locations?
Greetings!

Anonymous (11 years ago) Reply
Hey!Great Library and great job!
I'm trying to set up a positioning system including three PCs with Bluetooth for triangularization, measuring the distance between the NXT and each of them via the signal strenght..
It's a research project for the university.
Thanks a lot!

Epokh (11 years ago) Reply
I'm doing a Qt4 interface with your libraries.
Very nice project.
I just get some minor problems with synchronous calls but is not a big issue.

Simo (10 years ago) Reply
Hello, I have set up LD_LIBRARY_PATH to LD_LIBRARY_PATH=/opt/nxt/nxtlibc-0.1/ where the library is but compiling with gcc -lm -lbluetooth -lnxtlibc c.c -o c I receive the following error:
/usr/lib/gcc/i486-slackware-linux/4.2.4/../../../../i486-slackware-linux/bin/ld: cannot find -lnxtlibc
collect2: ld returned 1 exit status
Where I exactly missed something? Thank You for your support

Simo (10 years ago) Reply
Solved. I didn't executed make install. ;)

mcoder (10 years ago) Reply
hi, good work :) i want use two brick how to make connection between my laptop and two bricks?

Yuping SHEN (9 years ago) Reply
The library is perfect! But you will also have to read the above comments carefully to avoid some minor traps...
Thanks all!
