Switching pins of an Arduino


The Brenny | 11th Feb, 2015

I've been playing around with my Arduino for the past half year now and I have really come to enjoy it and how it works. I could write a quick program for the Arduino to do a specific task. And every time I wanted to do something new, a new program would be made. All the programs would just automatically switch the state of different pins. But this quickly got annoying to constantly upload a slightly modified version of a similar program...

I've been playing around with my Arduino for the past half year now and I have really come to enjoy it and how it works. I could write a quick program for the Arduino to do a specific task. And every time I wanted to do something new, a new program would be made. All the programs would just automatically switch the state of different pins. But this quickly got annoying to constantly upload a slightly modified version of a similar program...

A little later on, I decided to make a simple program that would allow me to tell each pin to turn on and off. So that's what I did. A small 30 line program that switched pins on my command. This soon grew to be able print out the state of every pin, tell me what state I'm switching a pin to, and even a help page! I added a hint that there would be a Clear Screen functionality, so the program can handle the clear screen input, but I never got round to making the algorithm to move the screen. That's where I stopped working on it because it met my needs of a pin switching program.

Only until recently! Recently I found out that I needed more than just an ordinary pin switching program. I needed a little bit more, and that's when my new creation of 154 lines comes in. One-hundred and fifty-four lines dedicated to switching the state of a pin (on/off), switching the mode of a pin (input/output), printing the data of the pins (pin | trigger-char | state | mode), printing a help screen, going loud if told to (verbosity), clearing the screen of a specified number of lines, and so on!

I have released two versions of this program: a documented version for the programmers, and an undocumented version for the ones who don't know what code is. Both of these have been uploaded to my GitHub Repo filled with Arduino Tools! Direct links to the Pin Switch program are below!

Pin Switch Program for Arduino (raw)

Pin Switch Program for Arduino (DOCUMENTED) (raw)

Oh oh...

Get in touch!


Got questions about programming, electronics, or life? Shoot an email!