[ Log In ]
Tumbnail: 62 oz-in NEMA 17 Stepping motors (also called stepper motor)

NEMA 17 Stepping Motor (62 oz-in 5mm single shaft)

$19.95 Out of Stock
Qty:
Image of the Atmega324p

Atmega324P

$8.50
Qty:

10K timmer potentiometer

10K Trimmer Potentiometer (Through Hole)

$0.85
Qty:
16x2 LCD (Liquid Crystal Display)

16x2 LCD (Liquid Crystal Display)

$12.50
Qty:
White prototyping breadboard with 30 tie strips and two power rails on each side.

White Prototyping Breadboard (2x30 columns of tie strips and 2x2 rows of power strips)

$7.95
Qty:
Clear Semi Transparent Breadboard

Clear Prototyping Breadboard (2x30 columns of tie strips and 2x2 rows of power strips)

$8.50
Qty:
Red Through Hole LED (Light emitting diode)

Single Red Through Hole LED (Light Emitting Diode)

$0.34
Qty:
Green through hole LED (light emitting diode)

Single Green Through Hole LED (Light Emitting Diode)

$0.34
Qty:
Yellow through hole LED (light emitting diode)

Single Yellow Through Hole LED (Light Emitting Diode)

$0.34
Qty:
Skip Navigation Links

Joe Z.'s Project

Everyone knows the first program is called the "Hello World" project. The Hello World program is intended for the newbie programmer get their feet wet and be as simple as possible. This is why, in the embedded realm, the Hello World programs is to simply turn on an LED. Joe didn't want to settle for the typical Light up, or blink the LED. He wanted to literally make a single LED communicate. How would a single LED communicate? Using morse code, obviously.

So, how did Joe do this? Joe programmed the microcontroller to turn on and off an LED in a sequence that communicates "Hello World". Joe is using the delay library to add time between the LED on and off appropriate for morse code interpretation. The letters that spell Hello World are made into functions that within these call the dash and dot functions. The dash and dot functions call LEDon and LEDoff functions which send the high and low to the port pin.

Joe was kind enough to send this video along with the program code. Thank you Joe!!

include <avr/io.h>
#include <util/delay.h>

int main(void)
{
DDRC = 0b00000001; //Data Direction Register setting pin0 to output and the remaining pins as input
while (1)
{
H(); //call the function that blinks H according to morse code
E();
L();
L();
O();
_delay_ms(10); //additional delay to signify pause between words
W();
O();
R();
L();
D();
_delay_ms(10);
LEDoff();
_delay_ms(500); // keeps all the lights off for 500ms to visibily show completion of loop
}
}

int H(void)
{
DOT();
DOT();
DOT();
DOT();
_delay_ms(10); //additional delay to signify a pause between letters
}

int E(void)
{
DOT();
_delay_ms(10);
}

int W(void)
{
DOT();
DASH();
DASH();
_delay_ms(10);
}

int O(void)
{
DASH();
DASH();
DASH();
_delay_ms(10);
}

int R(void)
{
DOT();
DASH();
DOT();
_delay_ms(10);
}

int L(void)
{
DOT();
DASH();
DOT();
DOT();
_delay_ms(10);
}

int D(void)
{
DASH();
DOT();
DOT();
_delay_ms(10);
}

int LEDon(void)
{
PORTC = 0b00000001; //Turn the LED on
}

int LEDoff(void)
{
PORTC = 0b00000000; //turn the LED off
}

int DASH(void)
{
LEDoff(); //clear all previous lights
LEDon(); //start our dash
_delay_ms(50); //50ms will be our dash time length
LEDoff(); //stop our dash
_delay_ms(10); //this delay is to give a pause between blinks
}

int DOT(void)
{
LEDoff(); //clear all previous lights
LEDon(); //start our dot
_delay_ms(10); //10ms will be our dot time length
LEDoff(); //stop our dot
_delay_ms(10); //this delay is to give a pause between blinks
}

Have you made a project that you would like to show and tell on newbiehack.com? It helps all of the newbies out there. Remember, you were one too.