Stupid Triangle Thing

...is the best name I can come up for this strange interactive computer contraption I've hacked together.

Full demo:


To start:
I made a p5js sketch which would do several things.
1. make triangles onscreen on a certain input
2. set colors to each triangle
3. randomize the position of each point of each triangle, the color of each triangle, and the background color on a certain input
4. interpolate the movement of the triangles and the color changes from one random point to another
5. allow the user to control the rate of interpolation (speed)

This was, as it would turn out, the easy part. I got it running in no time.



Then, I got an Arduino interface working which would return values from 1-10 for a pot, as well as separate values which I decided to label "11" and "12" for two separate buttons. Code here:

https://pastebin.com/qciFiYec

I got it returning the values needed to a serial port in no time, as well.



Circuitry:



I then spent the next few hours banging my head against a wall trying to get the two damn things to talk to each other. I vaguely recall the following events through a haze of frustration:
>installing Node.js
>installing p5serial incorrectly
>using node.js to install p5serial correctly
>getting a load of browser console errors
>giving up and switching to Edge because of my assortment of tinfoil-hat extensions on my favorite Chrome fork, Iridium, no doubt blocking communication
>giving up and considering switching to normal Processing, in the hopes that the serial interface wouldn't require some sort of server nonsense
>actually installing original Processing
>giving up and going back to p5js

After awhile, I came up with this:



It didn't handle the inputs anywhere near how I'd hoped it would, but I was happy I'd just gotten it vaguely functional. The next challenge was to somehow make the input make sense. I removed some conditionals from the Arduino code, added some timers into the p5 sketch, added some more conditionals, and played around with the same timers, until I eventually got to this point:



Since I was running up into time constraints, I had to deal with the lag and make it look "pretty" - so I exercised my expert gift-wrapping skills and gave the Arduino a shell to hide within.
As you can see in the top video, it's extremely laggy,
but
it
works.

and that's all that we can really ask for, isn't it?

full sketch code here:
https://pastebin.com/Hc9ZNzMb

Comments

Popular posts from this blog

veins - a weird visual toy

Squeezy Circle