Arduino Diary – Week 2

It’s been a busy week.  So much so, that I notice my last post here was… ah, a week ago, about this.

And so busy, indeed, that all I managed at our wee Arduino collective thing was two and a half hours.  Enough time to unpack, play a bit, and pack up.

I have a vague short term goal in mind, which came up last week:

“…an idea for short term project to focus on, something to aim towards; a very basic sliding potentiometer, that has a series of LED lights that light up as it’s turned up, and then a “send” button that tweets the status.  A kind of sliding mood status, or perhaps a productivity gauge I can score out of ten, and find peak productivity times.”

 

So, things about that I couldn’t do then:

– a series of lights that turns up, and down.
– a “send” button that sends an action back to the computer
– the understanding of how to send it to the twitter

With the little time I had today, I focus simply on the two things I think I can do… the LED lights, and a related send button.

Now, some trawling around in the backstreets and bazaars of Amazon resellers helped me find these little fellas:

LED bar graphs; each one an individual LED, with separate controls, but together as a unit.  Plug it in to the breadboard, wire each to a separate port on the Arduino, and then write/find some code which will work.

Actually, note on wiring; I seem to be developing a form of specific OCD about wiring wherever possible.  I may have wasted too much time on the green & yellows below, for instance.  I shall continue to convince myself I’m doing it so I can better see what I’m doing.

 

 

Funnily enough, I have not developed the same OCD about the code in Arduino, despite Pete’s best efforts to explain why it’s better / neater.  The indenting is a pattern I have yet to recognise as beautiful, perhaps; I wouldn’t necessarily consider the below to be a logical, easy to interpret way of understanding where you are.  I’ll either learn, or just make up a way that works better for me, I guess.

 

 

Another thing about the code; it’s always seemed like I should learn it from scratch, and understand every line.  There are tutorials for these things.  But… I’m basically a Lego coder at best; I think about the ‘size, shape and purpose’ of the bit of ‘Lego’ I need, I search on the internet for it, and find someone who’s done it already.

Which is exactly how I get this working…

 

Turn the dial, ramp up the LED display.  I didn’t put any resistors in, just to see what would happen.  It’s really bright.  So much so that I blew one of the lights, so the red display has been replaced with a blue one.   It’s more Jedi now than Sith, I guess.

Anyway, that was a very pleasing moment.

What was less pleasing was that I couldn’t get the “send” switch working on the same board.  I managed to do a simple switch last week.  I couldn’t today.  Two steps forward, one step back.  I’ll crack it next week.