Prototyypin rakentaminen / BUS4TN007-3 / Tehtava1 (assignment 1)

Hello,

This is my first post/blog in the WordPress site. I am currently studying at Haaga-Helia University of Applied Sciences. My major is Information Technology
(Degree Programme In Information Technology), and this course is about trying to build small prototypes (or bigger ones if you are up to it). Here is the outcome for of my assignment. Please excuse me the quality and angle of the photo.

IMG_0093[1]

IMG_0092[1]

The first assignment was to build a small code for Arduino to control the LED’s/LED.
The Arduino that is used for this assignment is Arduino Mega 2560.
The book that was assigned as our reading material is called
“Make: Arduino Bots and Gadgets” by Kimmo Karvinen & Tero Karvinen.

For the first assignment I tried the code and software for my Windows 7. The first hour I encountered my first  problem namely the grayed out ‘Serial Port’,

where choosing the port for Arduino was crucial to make the code work. I did manage to find help for my first problem from the source given below

http://emayssat.wordpress.com/2012/03/29/installing-windows-7-on-the-arduino-ide-or-vice-versas/ 

When I first started the led project I had no Idea, what I should do my project about so I thought to make Morse-code of my own name. In no way does the program follow the International Morse Code standards but you will get the idea when you implement the code. The code itself is ridiculous, but just for the sake of the assignment and practice I thought to start it easy. Here is a Wikipedia source for more information about the Morse Code

http://en.wikipedia.org/wiki/Morse_code

Last but not least, here is the link to my code. I have posted the whole code below this blog also.

http://www.2shared.com/file/gv2vagPF/Morse_Code_KUROSH.html

The compiler is version 1.5.1, and you can download it from their main page

http://arduino.cc/en/main/software

My next project will be a robot car. The sensor that would be good for this project is
direction sensor module, but I still have to think more about the project and the components that I will/have money to use in it but here is the link for starters.

http://dx.com/p/robox-arduino-compatible-ir-direction-sensor-module-145084

Here is the code for the Arduino board (UPDATED VERSION)

Updated 26.1.2013

.// The integers below are connected to Digital Pins

int greenPin = 13;     // LED that is connected to pin 13
int redPin = 12;          // LED that is connected to pin 12

void setup()
{
pinMode(greenPin, OUTPUT); // sets the digital pin as output
pinMode(redPin, OUTPUT);
}

void small()
{
digitalWrite(greenPin, HIGH); // sets the LED on
delay(500); // waits for a second
digitalWrite(greenPin, LOW); // sets the LED off
delay(1000);
}

void big()
{
digitalWrite(greenPin, HIGH);
delay(3000);
digitalWrite(greenPin, LOW);
delay(1000);
}

void red()
{
digitalWrite(redPin, HIGH);
delay(2000);
digitalWrite(redPin, LOW);
delay(1000);
}

void k()
{
big();
small();
big();
red();
}

void u()
{
small();
small();
big();
red();
}

void r()
{
small();
big();
small();
red();
}

void o()
{
big();
big();
big();

red();
}
void s()
{
small();
small();
small();
red();
}

void h()
{
small();
small();
small();
small();
red();
}

void loop()
{
k();
u();
r();
o();
s();
h();
}

Where the red LED signifies the change of the alphabet. Now before you start to do anything, you must never add components to your Arduino when it is plugged to your computer because it might damage the Arduino or the components that you are using. This should be common sense. Another thing that I must warn you about is that you should always do a good background research of any electronic component you want to install be it a laptop keyboard or Arduino sensor because you might do something stupid and short circuit the whole thing.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s