hello world.

hi all,

kinda new to microprocessor stuff
but i always wanted to get stuff like this to work.
arduino seems “easy” and a nice platform to try to build some of the things i have been thinking on for some long time.

i got some history with radio transmitters (27 mhz 70cm 2 m) packetradio, house electronics and programming on html, php and visual basic so this is a whole new game for me :slight_smile:

today i orderd a arduino test kit , breadboard, lcd display and some buttons.
my first project will be a alarmclock with multiple alarm times.

ill try to add some usefull post to this forum and ill try not to ask dificult questions ;D

now i got to find my soldering iron… should be in a box somewhere.

greets Daniel - Netherlands

Welcome Daniel, I’m sure you will find the Arduino (and this forum) a lot of fun. Lots of stuff to learn or relearn, but nothing that harms children or wildlife. :wink:

Lefty

ill try not to ask dificult questions

Hey, don’t do that: the difficult questions are the most fun.

Ran

got all the stuff from the mailman today
the arduino looks alot smaller then i tought it would be.
i ordered the ARDX kit aswell from floris.cc and made tutorial #2 to start with 8 leads blinking in a row.
after that i made my own code to test abit more (added below)
all seems to work great and easy.

Hey, don’t do that: the difficult questions are the most fun.

Ran

lol well this is the code i made do you got any sugestions how to make it better ?

//LED Pin Variables
int ledPins[] = {2,3,4,5,6,7,8,9}; //An array to hold the pin each LED is connected to i.e. LED #0 is connected to pin 2, LED #1, 3 and so on
                                   //to address an array use ledPins[0] this would equal 2 and ledPins[7] would equal 9
void setup()
{
  pinMode(ledPins[0],OUTPUT);
  pinMode(ledPins[1],OUTPUT);
  pinMode(ledPins[2],OUTPUT);
  pinMode(ledPins[3],OUTPUT);
  pinMode(ledPins[4],OUTPUT);
  pinMode(ledPins[5],OUTPUT);
  pinMode(ledPins[6],OUTPUT);
  pinMode(ledPins[7],OUTPUT);
}

void loop()                     // run over and over again
{
  int i = (random(0,8));
  digitalWrite(ledPins[i], HIGH);
  delay(100);
  
  i = (random(0,8));
  digitalWrite(ledPins[i], LOW);
  delay(100);
}

greetz daniel.

A few small things…

Using byte will save both program and data memory and result in slightly faster code (all good things with microcontrollers)…

byte ledPins[] = {2,3,4,5,6,7,8,9};

Using a for loop will simplify setup

#define NUMBEROF(a) (sizeof(a)/sizeof(a[0]))

void setup()
{
  for ( byte i=0; i < NUMBEROF(ledPins); ++i )
  {
    pinMode(ledPins[i],OUTPUT);
  }
}

Change i to byte

void loop()
{
  byte i = (random(0,8));