Sand Hill Scramble! (Scratchoff Ticket Interface)

Will your startup reach Unicorn Status ($1bn Valuation)? Find out now by playing Silicon Valley Scramble!!

The microcotnroller and soft-touch pot:

This was fairly straightforward to build (although the soft-touch switch was a little tricky to connect to the breadboard – I ended up buying a few female-to-male pre-soldered wires because the 3 male connections on the switch weren’t long enough to connect/stay connected to the breadboard). The middle pin is connected to the analog pin on the Arduino (via the purple cable), the pin to the right of it is wired up to ground, and the left-of-center pin is connected to power via two resistors.

Analog input to webpage:

You can see my switch half-works here. I tried several ways of mapping the analog switch values so that sliding around on the switch would actually increase the output value in the expected manner, but no matter what I tried it would only every be a binary “no touch = ~3-4, any touch = 255”.  I also tried treating other output pins on the soft-touch switch as the output pin, just in case I was reading the docs from the swtichmaker wrong, but the other pins wouldn’t give any sort of dynamic output at all.

I took this binary on-off output and hooked it up to a webpage in the Arduino IDE, and set the webpage to reload every second – you can see the complete code in this video:

Here is the digital portion of the interface – built in Framer (https://www.framer.com). In the video below you can first see the graphics I designed, the code I wrote (in brief: it 1.) picks a random number out of 0-4 that determines which screen will display when you get to your results, and 2.) dials back the opacity of the “gold scratch-off” layer in accordance with how long you press down. I had also wanted some gold shavings to fly everywhere as you scratched, but some of the animations for this were giving me difficulty and didn’t make the final cut).

As I’ll show below, I couldn’t not get Arduino and Framer talking to each other via an API call. However, if I had, I would have been able to take the analog input from the soft-touch switch and set something like “if analog_input ==255, start opacity fade”. If the switch had worked as intended, I would’ve been able to add an even greater level of realism, and possibly track the switch’s position directly within Framer to, say, move a finger directly in accordance with where your actual finger was on the soft-touch pot. Someone on the inter webs accomplished this (somehow) via Arduino -> MIDI (offline, on your mac) -> Framer (https://www.youtube.com/watch?v=Sik8Ppnegmo&feature=youtu.be). But after downloading the necessary library I couldn’t get his approach to work, and it wasn’t using the methods we were covering in the class (over networks/REST calls).

 

In the video below you can see how Framer would normally make API calls and receive JSON. Here I use a Framer function to read some dummy JSON from a dummy endpoint, and print it to the console of my interface.

Knowing that was working, I tried to use the URL of my Arduino webpage to get the JSON data and analog switch value, but I kept getting a 404 error.