I've been working on my first Mac app for a few weeks and I'm launching it today. It's super-niche and solves a really specific problem: Drawing pictures to an 8x8 LED matrix breakout board from an Arduino. Let's say you wanted to draw a smiley face. In code, that looks like this:
This isn't as complicated as some tutorials make it seem. You don't need a resistor and each push button just needs one wire to an input pin and one wire to ground. Wire up your button to your Uno like this:
In the setup() function of your code set the input pin to INPUT_PULLUP:
To determine if your button is being pushed you do a standard digitalRead on the pin. The only tricky part with this is that you aren't looking for a HIGH signal like you might assume – your button will give off LOW when it's pressed. You'll also want to add a delay statement to limit the amount of reads per second you perform on the button. This keeps your code from executing over and over when your button is held down. Here's the code:
It's easy to expand out to more buttons – just make sure they share a common ground. Here's an example with two buttons:
If you're out of digital pins on your Uno, the analog input pins can be used as bonus digital pins – great if you've already used all your digital pins up through something with a lot of wiring like a seven-segment display.
This blog post from Crisp is the only example of a JSON Pretty Print BBEdit text filter I could find and unfortunately I was only able to get it to work about 25% of the time – the other 75% I would get this error message from BBEdit:
Invalid parameters were detected for an operation (MacOS Error code: -50)
There's not a lot going on in the script so I banged my head against it until I figured out how to fix it: Aggressively insisting on UTF-8 string encoding. Here's the modified script:
Call me old-fashioned if you want, but when I write code I want to do it in a Cocoa window, like a dignified human being. So I was pretty disappointed to find out that the primary IDE for the Spark Core is a text box on a web site:
Obviously that's not gonna do. I dug a little deeper and it turns out that there is a Spark desktop app called Spark Dev – but it's a fork of Atom, Github's web-based text editor. No thanks.