My first go with the Arduino

I have some interesting plans, but to get there I needed to learn something about microprocessors and programming them. Just browsing around I realised that the Arduino seems to be the more popular and thus more “supported” architecture and bought myself an Arduino UNO from which for all intents is a beginners board.

Arduino UNO Specifications

Microcontroller ATmega328
Operating Voltage 5V
Input Voltage (recommended) 7-12V
Input Voltage (limits) 6-20V
Digital I/O Pins 14 (of which 6 provide PWM output)
Analog Input Pins 6
DC Current per I/O Pin 40 mA
DC Current for 3.3V Pin 50 mA
Flash Memory 32 KB (ATmega328) of which 0.5 KB used by bootloader
SRAM 2 KB (ATmega328)
EEPROM 1 KB (ATmega328)
Clock Speed 16 MHz

I have not had much chance to get much further than make some lights flash but my quick foray into the language reference guide didn’t scare me off and that is a good thing.

My first attempt at the code was over 60 lines, halved it with a couple of while loops to look like this

void setup() {
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(13, OUTPUT);

void loop() {
  int  Channel_Counter = 9;
  int  Highest_Channel = 13;
  int  Lowest_Channel = 9;
  int  LampDelay = 100;
  while (Channel_Counter <= Highest_Channel) {
    digitalWrite(Channel_Counter, HIGH);
    if (Channel_Counter < Highest_Channel) {
      digitalWrite(Channel_Counter, LOW);
    Channel_Counter = Channel_Counter + 1;
  while (Channel_Counter >= Lowest_Channel) {
    digitalWrite(Channel_Counter, HIGH);
    if (Channel_Counter > Lowest_Channel) {
      digitalWrite(Channel_Counter, LOW);
    Channel_Counter = Channel_Counter - 1;

which resulted in (sorry about the technocrap only 5 second track I could find)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.