I tried to let the NXC compile my program using a function SetSensorUltrasonic() I took from the documentation, but for some reason it does just not compile.  He always complains about it beeing non-existent. Versions match, function name ist the same - even codes from the internet including this function don't work. This made me look a bit more deep inside the NXC/NBC connection: Why do I get errors with exactly the same content multiple times? Why do some functiona generate weird error when writting multiple command in one line? These were really strange things to me - a compiler written for a specific language does usually cover every wrong syntax with a specific message in a more or less readable but often unique format. Not so with NBC, I had soooo weird errors with this compiler. I did something wrong, intentionially or not, I wasn't always able to get the real message he was telling me.

Some webpages later I discovered that the creator used macros instead of functions! Yes, macros - macros ONLY. And thus some of these weird messages come from the fact that he had to code a mechanic to trace error back to the original NBC code, resulting in multiple errors (for one line) with exactly the same content cause wrong parameters get inserted into multiple lines of NBC assembler code it does translate to during compilation. So what do we have in the end? A compiler that's rather a blind translator and not the original language. Fortunately, there's a (so far) rather understandable documentation of NBC and all of it's functionalities. To avoid further annoying suprises I'm currently learning how to in NBC and thus in some kind of Assembler-like language (which can only be useful in my later life). It's a simple syntax and also offers a macro system with some kind of strange features which could ultimately lead to some interesting code generation macros and some other things interesting for personal development.

I'm at the very low end of NXT programming. If something WON'T work this way, I'll probably get VERY VERY ANGRY in the end. I don't want delays anymore, I want TO FUCKING CODE MY IDEAS. Also, I designed an interesting little system for making the NXT a digital synthesizer. Cause most functions will be done by the firmware, I can use functions to generate tone a specific frequence and amplitude. My idea is to create a little synthesizer with a system or digital LFOs and ADSR generators and allterate the played amplitude and frequency of the playing sound. The concept is ready and the real work lies in learning NBC and create a keyboard for it. However, all things are ready to go, I'll only have to realize in NBC. And I'm sure it won't be as nice to code as with standard C... Atleast, it's the lowest possible level with standard firmware, providing all functions out of the box and with no further developer-accessible layers. I just CAN'T do anything non-working with it. It has to work!

No comments: