maanantai 21. tammikuuta 2013

First week of prototype course

First task was to burn xubuntu live cd. I burned other cd's as well.



First lesson of prototype course was very impressive, all other courses are boring or I feel somehow stupid doing other courses. This was the first course this year when I felt I'm in the right place. Maybe later I will attend other Tero's courses if I have time.

The idea of the course is to build your own prototype and show it to others. Prototype is some kind of demoversion. Here are the "brains" called arduino in the picture.


First program or machine:

I installed Lubuntu in dualboot and then opened command prompt:

sudo apt-get update  (here i updated the software database)
sudo apt-get install arduino (this code installs the arduino environment)
newgrp dialout (adds dialout group which is needed in arduino)
arduino (starts the actual programming thing)

At first i downloaded Arduino "Hello World!" program which blinks led light in socket 13 with 1 second delay. It worked and so I was sure the developing environment worked. Then I installed three leds on the testing board and programmed them to blink in order, first led blinks 3 times, second 2 times and the last one of course once. It worked very well ! Here is a video how the system works:


And here is the actual code:

void setup() {            
 pinMode(2, OUTPUT);
 pinMode(3, OUTPUT);
 pinMode(4, OUTPUT);
}
void green(){
  digitalWrite(3, HIGH);
  delay(150);
  digitalWrite(3, LOW);
  delay(150);
}
void yellow(){
  digitalWrite(4, HIGH);
  delay(50);
  digitalWrite(4, LOW);
  delay(50);
}
void red(){
  digitalWrite(2, HIGH);
  delay(100);
  digitalWrite(2, LOW);
  delay(100);
}
void loop() {
  for (int i = 0; i < 3; i++){
  red();
  }
 for (int i = 0; i < 2; i++){
  green();
  }
  yellow();
}

Some screenshot:


Last task was to invent a system with uses some sensor. I couldn't think anything so i just developed basic alarm system. We could use a ultrasonic sensor or infrared if there is a movement in the house or some place and then send email or pictures with webcam to internet to see what is currently happening in the house.

How to setup the arduino environment:


$ setxkbmap fi
$ sudo apt-get update
$ sudo apt-get install arduino
$ sudo adduser xubuntu dialout
$ newgrp dialout
$ arduino

Ei kommentteja:

Lähetä kommentti