Arduino Morse – pt. 2 – only Morseo

In my last post I wrote about a Morse code project I wrote for Arduino. I have a few additions to make on that subject..

Firstly, I rewrote the main bits of this code as a library, and renamed it Morseo (pronounced “more so.” It’s like a pun). It’s on GitHub now as well.. I’ll probably delete the old project.

In the course of turning it into a library I learned a few things.. primarily, how to turn it into a library. Arduino’s guide to making a library uses as an example a program that flashes, wait for it, Morse code. That was a fun coincidence, though I would note their example only flashes “SOS,” and mine does more than that. Still, kind of annoying. I’m under no impression that this project is unique, but I’d prefer it not to resemble the boilerplate.

Secondly, Arduino is coded in C++, not so much C, as I asserted in my last post. Duly noted.

Finally, Arduino includes a serial library for writing messages back to the PC host you’ve plugged it into via USB. Somehow I neglected to know this when I developed Morseo, which meant I had exactly one LED to debug with. This made debugging a lot of fun — seriously, it was a fun challenge — but more tedious than necessary. Next time, I’ll use the serial library to send myself messages, and I would hope anyone approaching Arduino programming for the first time knows this at the beginning.

Up next: I have a wifi adapter now, I think a good next step would be to flash statements from a Twitter account or something.

Posted in Programming, Projects | Leave a comment

Arduino Morse

For my first Arduino project (and my first project of any sort on Github) I chose something that could manipulate Arduino’s on-board LED — as per the “Blink” sample project, since it would require no additional hardware — but what can you do with a single light? Morse code, naturally.

Arduinos are generally programmed in C, and I’m a C# developer mainly, so this would be a fun evenings and weekends project. I wanted to define a string of text and have the LED blink that message out in Morse. The message would be hard-coded in the program itself, though if the input part of it were to ever become more dynamic (like from reading a Tweet, or something) then the rest should be mostly reusable.

The first version of the program didn’t take very long to write, but it wasn’t very elegant. I wanted to separate some of its various concerns into separate functions, so I tried again. Here I ran into some peculiarities with how C handles strings that was taking a lot of time to figure out. Other things came up and I put the project aside for a while.

I picked it up again finally a couple of weeks ago and finished it off. The string issues I had that weren’t immediately obvious included:

  • You can use char* to declare a string variable and initialize it later, but once initialized it’s read-only. You can’t treat it like a regular array and alter individual chars.
  • If you declare a char* with the intent to initialize it in another function, you need to pass it as a char**.
  • The aforementioned char pointer issues became moot when I found what I really wanted was to declare a string variable in one function, initialize it in another, and also manipulate its char elements. In C# you don’t have to think very hard to do this, you can do most anything you want to a string and it “just works.” In my case I found I had to use char arrays, and to treat these variables as buffers.

I’d seen this pattern often enough before, of declaring a buffer of some length and passing it into a function by reference, usually when doing some sort of I/O to/from a socket or file. I don’t know if that was the only option I had to work with, but in the end it did what I wanted.

arduino morse blink

It’s the orange light

For what it does, which is next to nothing, the program might be a bit overengineered. The main point of the project though was to learn something new and have fun with it. A next step along those lines might be to make it into a Morse library with some abstractions around possible input and output options, just to learn how C libraries work. I don’t know. I know other Morse programs for Arduino exist and I’ve purposefully ignored them so I can play this out for what its worth as a learning exercise. If anyone wants to work with this code and send me suggestions/corrections, definitely please do that.

Posted in Programming, Uncategorized | 1 Comment

Not Old

BoW 36 - 6/7/2014

Thanks Levi!

Posted in Shows, Sun Tunnels | Leave a comment

Notice Me

I’m excited to report that the sun tunnels song “Notice Me” is featured on the KEXP Music that Matters podcast #398. This is the same “Notice Me” that appeared on Ball of Wax #34 back in November. If you like it you can even buy it for 50 cents. (Which you should, because of capitalism.)

KEXP Logoball of wax 34

It feels really great to be a. noticed (ha), and b. in such good company, in the mix with a bunch of other great bands including Iska Dhaaf, who are pretty awesome. Cheryl picks good music, many thanks to her for listening to our track and liking it so much.

FYI, this recording came together last year after I started going to Sarah McGuinn‘s house to record songs with her. She took what I had of this song and did some arranging, then recorded most of it. I’d come over to sing and play my guitar, and she took care of the rest, except bass, which was Sugar McGuinn. It turned out really well, so we’ll keep doing that.

Posted in Sun Tunnels | Leave a comment

Faraway, So Close

Early last year something reminded me of this song that I hadn’t heard in a long time, I now realize it’s my favorite U2 song.


U2 ~ Stay (Faraway, So Close!) ’93 by seasonwitch

I remember hearing it on my favorite Naples radio station 20 years ago. They also played Cracker (“Low”), Spin Doctors (“2 Princes”), Culture Beat (“Mr. Vain”), Jovanotti (“Serenata Rap”), Radiohead (“Creep”), Pet Shop Boys (lots of it), Nirvana, tons of weird techno. After a certain hour the DJ would say “miscelazione in progresso” and I guess that meant they were mixing things so you could dance, and the pop songs stopped til the next day.

Jovanotti – Serenata Rap (Julo alias Python Retro Hits) from Julo a.P. on Vimeo.

I was ages 12 to 16, in our garage, building things out of balsa. In the improbably posh gated apartment compound we lived in (courtesy the American taxpayer — who actually got a really good deal on it), the garages were carved out of the side of a cliff and had loud sheet metal doors bolted to the rock. I set up a makeshift workbench and some lights and turned our car’s radio on.

I also tried to tame these cats.

I tried to tame these cats.

Sometimes I played tapes. I had Bryan Adams greatest hits (So Far So Good), Pearl Jam (Ten and Vs.), Nirvana, some mix tapes a friend made of Elvis and other 50s rock. CDs from the Green Linnet record label, which my brother gave to my father, since we’d just acquired a CD player and our last name is Irish. A great double cassette of Irish rock my father brought back for me at some point when he visited Ireland. Sometimes I played a specific tape of Neapolitan folk songs that we had for some reason and that I thought might endear me to the neighbors. I liked it too, that stuff was great.

When I heard “Faraway, So Close” again after 20 years, it was the first time I’d thought of all that in about as long. It was temporally and geographically specific.

What I didn’t realize when I was hearing it in 1993 is that the song was tied into a movie of the same name.

In the intervening time I’d become a fan of Wings of Desire, a movie that works on me in a particular, sort of nostalgic way, but different. It’s hard to explain. The way it’s shot and put together — the long sequences, the slow build, the lack of explanation, the setting. Berlin, late in the Cold War — a place I can only imagine in black and white, and that’s how they shot it. Bruno Ganz, Peter Falk(!). Plus, Nick Cave and the Bad Seeds being awesome at some West Berlin rock club. Badass.

That Faraway, So Close is the sequel to Wings of Desire, and also my favorite U2 song, etc. — well, that sounds just great. I had to see this movie. On my birthday last year I did just that.

I’m sad to report Faraway, So Close is a lousy movie. It started out good — the first 15 minutes feel like its predecessor. Then it’s downhill from there. What was subtle and mysterious and great in the first one is played for laughs in the second. It’s heavy-handed, too long by half, silly in the extreme — what a disappointment. If you like Wings of Desire, don’t see Faraway So Close.

The song is still good though.

Posted in Misc | Leave a comment