Categories
Uncategorized

Pocket Operator Programming Chart

I’ve been doing these Pocket Operator Jams for a while now and I noticed that the more complex ones (with multiple Pocket Operators) require some notes when programming the sequences. I was hastily jotting down notes but then I came up with this Pocket Operator Programming Chart. (You can download a PDF of it!)

Pocket Operator Programming Chart

The way it works is simple. You can keep track of each PO by number (or name) and then create the sequence, writing the pattern numbers. You can just leave it blank when you want a PO to drop out (or write in a blank pattern number). I’m still experimenting with this stuff but it’s definitely come in handy. I’ve said it before, programming music sequencers is a little like programming computers, but more fun.

The paper is super-handy to look at and follow along with while you set the sequence for each PO. I tend to read the chart, count out loud, and press the appropriate buttons. Works for me.

This 16 step chart works for most of my jams since it keeps things under a minute at 80 bpm. Since the PO-12 and PO-16 can only chain up to 16 patterns, this works out well.

Here’s some examples of using the chart.

Categories
Uncategorized

Reprogramming an ATtiny85 Blink/Fade Board

A few years ago I helped Josh with the code for the Blink/Fade Board that Brown Dog Gadgets has in their Crazy Circuits kit.

This is a simple board that comes preprogrammed to do a few specific things, with the idea that you can start using it even if you don’t know how to program or upload code to a controller. Besides power in, ground, and reset, there are five GPIO pins that we can use:

  • Pin 0: fades in and out
  • Pin 1: heartbeat
  • Pin 2: twinkles randomly
  • Pin 3: blinks on and off
  • Pin 4: blinks off and on (alternates with Pin 3)

We’ve always said that expert users could reprogram it to do anything an ATtiny85 can do, but we never had a guide… until now. Courtesy of Brown Dog Gadgets here’s the Guide to Reprogramming a Blink/Fade Board!

We’re using the Arduino IDE along with a SparkFun Tiny AVR Programmer to do the heavy lifting… You’ll also need to build a little LEGO jig with some Maker Tape and Crazy Circuits components and some Dupont jumper wires to string it all together.

After I reprogrammed the board I popped it out of the programming jig and popped it into a simple circuit to control the brightness of an LED with a potentiometer. You can’t do too much with an ATtiny85 but it does have a few inputs & outputs and you can even control a NeoPixel strip with it! (A guide for that will be coming soon.)

Like most of the guides we do there are some nice diagrams and downloadable PDF files with more/helpful info. Here’s one covering the reprogramming aspect of the guide…

And here’s one that shows using the reprogrammed board in the LED/potentiometer circuit. (The code for BFDimmer is available.)

I’ve been doing my best to keep cranking out fun and educational guides for projects. While a lot of them have been focused on simple circuits or Arduino-based things, we’ll be expanding into Micro:bit projects in the coming weeks, which has definitely been interesting.

Categories
Uncategorized

Learning to Code

Copying and Pasting

I saw many friends share this amusing image of a fake O’Reilly book titled “Copying and Pasting from Stack Overflow”, and if you’re not in on the joke, Stack Overflow is a web site where you can post programming questions and get answers to those questions. It’s also a site (like many others) where people who are not sure what they are doing grab bits of code from when they are not 100% sure what they are doing. (And if you don’t know about O’Reilly, they publish technical books, many about programming.)

This is the first semester I’ve taught a class that includes programming. I was upfront with students about how I’ve learned to write code over the years, and that includes looking at examples, using existing code, and (eventually) reusing my own code. I didn’t force them to type out each line of an Arduino sketch because I didn’t think it was completely necessary. They already know how to type, and once I showed them how to hit the compile button, they learned about syntax errors. Occasionally in class I’d demo things by writing code on the fly and inviting them to type up what I just typed, and to play around with the values, add more lines, etc. (I showed them the “Examples” menu early on, which contains plenty of useful code to get started with.)

Here’s something that may be news to some readers – I’m not a great programmer. I’m a hacker, and I can write enough code to get by, but more importantly I can find enough sample code and examples and tutorials to write the code that I need to do what I want to do. I think that’s the key to things.

If you’ve ever heard the expression “To be a great writer, you need to be a great reader” then perhaps this also applies to programming, and reading code is an important part of writing code.

Now, with all that said, I still expect students to learn some of the basics of writing code and understanding it. If at the end of the semester all they’ve done is copied & pasted code that someone else wrote, and by some miracle it compiles and runs and works for their project, that’s still sort of good, but not quite as good as having a basic understanding of what exactly those lines of code are doing.

In the meantime, keep copying code, and pasting code, and while you’re at it, try to read it and understand it.

Categories
Audio Channel

Functional Programming

BarCampMadison This is a session by Dan from MadCamp (aka BarCampMadison the 4th) titled “Functional Programming: Why Should You Care?”

You can also download an MP3 file if you’d like. (And for our freedom loving friends, enjoy an Ogg file.)

Also, if you want to get all of the audio automagically downloaded podcasting style, subscribe to the feed.

Categories
Uncategorized

Defending Perl

I stand here today not to condemn Perl, but to defend it… Perl

And when I say “Perl” I want you to feel free to substitute any other language you see fit… Visual Basic, Fortran, Lisp, COBOL, Smalltalk, or even… Java.

I was given a programming assignment this week. Given a list of 2000 names, I was to provide 400 names randomly. (Yes, this was for work, and was a real-world assignment, not just some exercise.) I proceeded to open my ~/scripts folder, which contains well over 1,000 Perl scripts, and grabbed some existing code, and wrote some new code, and ran a few tests, and quickly had the list of 400 names.

I used Perl because it worked for me. I probably could have written in it PHP (as it’s another language I am pretty comfortable with) but since I’m more familiar with Perl, and have done very similar thing before with Perl, and had a gigantic library (nearly 15 years worth) of Perl scripts to pull from… I used Perl.

I’m sure others could tell stories just like this substituting Java, or Python, or Erlang, or whatever they have around, that they are the most familiar with… and that’s fine.

This is about using the appropriate tool for the job, and this case, with the job being performed by me, the tool was Perl.

I wasn’t creating some new framework, or building upon an existing application, or pushing some code to GitHub that I wanted others to collaborate on… it was a quick ‘n dirty task that needed to get done as fast as possible.

Much of the programming world (maybe it’s mostly in the web-programming world) gets hung up on the latest and greatest. There’s a chance that using Ruby someone could have completed this task in half the time… but that person would not have been me, as I’ve spent probably less than an hour using Ruby and I’m not familiar enough with it to bang out the needed code quickly. I’d like to have some time to dig into Ruby (or, whatever, pick a language) and get familiar enough with it to use it effectively, but I don’t know when that will happen.

I’m not even a programmer… I’m a hacker, and I think Perl is a hacker’s language. Make something work. Solve a problem. Do it quickly, and move on.

To some degree you could say I’m trapped in Perl, because it is so easy for me to get what I want done quickly, and yeah, there’s a module for almost everything… Where I mainly feel the pain is when I look for example code and narrow my search to Perl (or PHP) because I’m most familiar with them. I needed some code this week to do some serial port communication, and found only one good example written in Perl. I should probably task myself with re-writing the code in Ruby, or Python, or some other language I’m not as comfortable with as an exercise in forced learning.

And then there’s a part of me that just says “screw it, I’m gonna work with what I know, and get things done, and move on.”