Loginskip to content

Archive for November 28th, 2006

Array Block for NXT

Tuesday, November 28th, 2006

Hi everyone, my name is Adam Parkes. I’m a new contributor to nxtasy.org. This is my first time working with robots, I’m a programmer normally, so I guess thats why most of my robots look really crummy. One of the first things that I noticed in the NXT standard development language is that there wasn’t an array block . After a few quick minutes of thinking about how to implement one I developed a block that handles reading and writing to a pseudo array of data. The reason I call it pseudo is that the block mimics an array, in reality the data blocks may not be located right next to each other, not that it matters much anyway for all intent and purpose it can be used exactly like an array. The block has one major drawback, it is unable to be resized at runtime. This is due to the block being hard-coded to have the exact number of data members needed in the array before compile time.

The Array Tutorial

I have provided a tutorial on how the block functions and how to make your own. Using a similar structure you could implement an aggregate data type, e.g. classes or structs. If anyone wants a tutorial on how to make an aggregate data structure with NXT just drop me an email.

Till NXTime.