Showing posts with label nxc. Show all posts
Showing posts with label nxc. Show all posts
Unknown
I'm finding an interesting application of operating systems to coding and debugging my little robot -- tentatively named HAL 0.

Interestingly, the NXT not only supports multithreading, it can have up to 255 threads. NXC (Not eXactly C) calls these threads tasks. We also have to deal with mutexes, which is necessary when you consider the consequences of having parallel threads all trying to control the motors.

My understanding thus far is that
(1) You always have a main task. This task is executed first, sets what sensors are connected to which ports, and can determine the order in which the other tasks are started.
(2) If you want task 2 to start after task 1, you can start it off with a Follows(task 1) command. I suspect, however, that this is part of the problem I'm having with switching mutexes between tasks. Unfortunately the StartTask command doesn't seem to work and since NXC is kinda like C, I can't use a StartTask(task 2) command in task 1 because task 2 hasn't been defined yet. Oh the joys of C.

In the course of writing this post, I've had a bit of an epiphany, so I may edit this post later today...
Unknown
My newest project is playing with LEGO's - every child's dream! Or at least mine. I find it really satisfying to come in every day and work with LEGO's. I want to properly document my progress, so I'll update this from time to time with little things I've figured out, videos, etc. For example, as soon as I find a satisfying way to use NXC on a Mac, it'll be here on this blog.

For now, here is a picture of my little robot - I-Bug. It is a differential drive robot with two touch sensors and a light sensor. I'm currently working on boundary following, and as soon as that's up and running, I'll do a video.


If any of you know of a good solution to NXC + Mac OS X, let me know!