Showing posts with label arduino. Show all posts
Showing posts with label arduino. Show all posts

Friday, October 23, 2009

My home temperature with arduino!

Purpose:
My home temperature with arduino!

URL:
http://sgez.homeip.net:888

Tools:
  • Internet connected router
  • Portforwarding to port 888 for ip 192.168.1.99 (arduino ethernet shield ip address)
  • Arduino Duemilanove
  • Arduino Ethernet Shield
  • A buzzer
  • Ethernet cable
  • Cable connectors
Difficulty / Time to complete:
Intermediate / 30 minutes

Schematic / Arduino code:
The following abstract schematic was used:

Saturday, October 17, 2009

Tutorial: First Arduino program - Kit's lights

Purpose:
Flash 4 leds from right to left and left to light.

Difficulty / Time to complete:

Beginner / 5 minutes

Tools:

  • Arduino board (tested on duemilanove)
  • 4 LEDs
  • 1 switch
  • 1 10K/.25W resistor
  • Workstation with Arduino 0.017 or higher
Arduino code:
int leds[]={10,11,12,13};   //pins with leds
const int dl = 75; //delay between moving
const int btn = 9; //button pin
int btnS = 0; //button state
int i=0; //general purpose counter

void setup(){
for(i=0;ipinMode(leds[i],OUTPUT);
}
pinMode(btn,INPUT);
myflash(leds,sizeof(leds),dl,false);
myflash(leds,sizeof(leds),dl,true);
}

void loop(){
btnS = digitalRead(btn);

if(btnS == HIGH){
myflash(leds,sizeof(leds),dl,false);
myflash(leds,sizeof(leds),dl,true);
delay(250);
}
else{
for(i=0;idigitalWrite(leds[i],LOW);
}
}

//myflash function: flash an array of pins to the R or L
void myflash(int arr[],int size,int delay1,boolean reverse){
int j = 0;
if(reverse==true){
for(j=(size-1);j>=0;j--){
digitalWrite(arr[j],HIGH);
delay(delay1);
digitalWrite(arr[j],LOW);
}
}
else {
for(j=0;jdigitalWrite(arr[j],HIGH);
delay(delay1);
digitalWrite(arr[j],LOW);
}
}
}
Note: After copying-pasting code to the Arduino IDE, press Ctrl+T to fix indents.

The final product (video):

Wednesday, October 14, 2009

Arduino - first impressions

Open source at its best (both in hardware and software)!

Pros (+):

  • Nice, compact design
  • Usb interface
  • Broad source code from arduino.cc and other sites/blogs
  • Ready-made IDE/usb drivers
  • Linux/Mac/Windows portable (both IDE and PC-to-Arduino dev)
  • Easy PC-to-Arduino dev via the Processing Language
  • Very cheap!
  • Lots of shields available!
Cons(-):
  • Linux driver installation requires some more steps
  • Addictive
  • Must buy more shields (who wants to blink leds all day long?)!
I dual boot on my Eee PC 1000h (Windows Xp/Ubuntu 9.10b):there is a remarkable difference from the IDE to the sketch loading on the Atmel.