Search

Learning Arduino - Day 2

I have a few bits and pieces from previous enthusiasms, including a solderless breadboard but no jumper leads, so first thing a walk to Maplin down the road - Gloucester Road in Bishopston is still one the nation's great high streets and despite the cold, is as busy today, Sunday, as any other day.

Then to sort out some old resistors I had lying around - at least they don't go off! But reading values needs better eyesight than I have now. How do people keep these things in some order?

Plugging the Arduino back in, I'm surprised to find (but shouldn't have been) that it continues to run last night's morse code program as soon as the power goes on.  Now to make it drive an external LED. First take 5v and ground from the Arduino board to the rails on the breadboard, then a LED and a 220 ohm resistor to limit the current and power it from pin 13. But wait!  which way round does that LED go? A quick google finds the Wikipedia article ( excellent)  and the information that the -ve side has a flat edge (symbolic of a - sign I guess) . My last attempt at electronics must have been pre-internet because I cannot now imagine life without the internet on the workbench.

Plug it together, upload and lo - there is the big red LED flashing BRISTOL as well as the onboard light. How immediately satisfying this is, trivial though it is!  Ideas for projects buzz around - or as Michael Feathers (@mfeathers)  just tweeted -"I keep finding ideas in my head".

Next to try using the PWM (Pulse Width Modulation) outputs to control the voltage to the LED and hence the light level.The simple fader example works, with the LED +ve moved to one of the PWM ports (9).  Interesting that the apparent brightness is non-linear with a linear change in level. Adding logging to the Serial line shows that the LED is pretty much full on at a setting of about 120 (out of 255 max ). 

I just love this IDE. I found the multiple windows a bit confusing at first but actually its more useful than separate tags (as in Oxygen which is my main editor now) because you can view multiple scripts (sorry sketches) at the same time. Better still if you have multiple screens - though 2 just isn't enough for me now  Today though its one too many as they have got switched over somehow so to move from one to other means moving the cursor round the back of my head :-( )

Now I find that connecting other bits to the breadboard needs some jumpers with crocodiles on one end, pins on the other.  My attempt to make them out of some old leads fails - soldered leads as pins dont work so well. Trouble is that my soldering iron is on the boat and all I have here is an iron used for leaded class work - another expense coming up. Pity my family dont read this blog.

So very modest progress and yet another visit to Maplins looks likely.