The Perfect Storm

A couple of weeks ago, I found myself in the mall. Mostly because I drove there. Which I did because my wife had things she needed to get and wanted me to drive. So while she did her things, I decided to see what the Lego store had on hand. Apparently, they had Legos. Which was to be expected. However, they also had several copies of Robot Inventor 51515, aka Lego Mindstorms. Normally, this wouldn’t be out of the ordinary, but 51515 has been on the “Retiring” list for about 6 months now. They’re probably just selling out their existing stock.

“Retiring” aka Why I’m a mark

Now, I didn’t get a discount on the set. It retailed for $360. I paid $360. Also the only real thing being retired is the Mindstorms brand itself. All of the important bits are still going to exist as part of the Lego SPIKE brand. 51515 comes with a Large Hub, 4 Medium Angular Motors, a Distance Sensor, and a Color Sensor. So, not a bad deal, as that will run you over $400 purchased individually. Toss in about $100 worth of Technic and it’s not a horrible deal. At least, that’s what I tell myself.

Making music

The hub contains a small speaker, a 25 segment light grid, a gyroscope, and other things. So, as a small test, I wrote up a small program to change the note being played based on the position of the hub. The speaker itself has a limited range, from 44Hz to 123. So you have 80 distinct values you can play. Actually, I never checked to see if you could use decimals, so it may be more. The gyroscope reports the full 360 degrees of movement. So I chose to basically use it like a knob. Going from -90 to 90 degrees. But I know I’m not going to be exact with my rotations, so I clamped the values. Now, I have 180 degrees to map onto 80 tones. I decided to be lazy and just divide the number of degrees by 3 and disregard 20 tones.

And success

That was easy enough. It was mostly just a test to be able to read from the sensors, output to something else, make sure the python could be uploaded to the hub, etc.

Now I need to find something to do with this.

By toast