Recently I decided to get started prototyping the VR device I invented back in 2014. I chose to use an Arduino Uno R3 for my micro-controller. I was amazed how easy it was to get started right out of the box!
Below is a copy of my first Arduino “Sketch” (they are known as sketches rather than programs or scripts), it repeats “hello world” in Morse code.
This is a very simple way to accomplish this, not necessarily the best way. I don’t store any values or functions which would probably improve the efficiency a little.
void setup() {
pinMode(13, OUTPUT);
}
void loop() {
//hello world morse code
//H
digitalWrite(13, HIGH); // sets the LED on
delay(200); // waits for a second
digitalWrite(13, LOW); // sets the LED off
delay(100);
digitalWrite(13, HIGH); // sets the LED on
delay(200); // waits for a second
digitalWrite(13, LOW); // sets the LED off
delay(100);
digitalWrite(13, HIGH); // sets the LED on
delay(200); // waits for a second
digitalWrite(13, LOW); // sets the LED off
delay(100);
digitalWrite(13, HIGH); // sets the LED on
delay(200); // waits for a second
//break
digitalWrite(13, LOW); // sets the LED off
delay(400);
//E
digitalWrite(13, HIGH); // sets the LED on
delay(200);
//break
digitalWrite(13, LOW); // sets the LED off
delay(400);
//L
digitalWrite(13, HIGH); // sets the LED on
delay(200);
digitalWrite(13, LOW); // sets the LED off
delay(100);
digitalWrite(13, HIGH); // sets the LED on
delay(400);
digitalWrite(13, LOW); // sets the LED off
delay(100);
digitalWrite(13, HIGH); // sets the LED on
delay(200);
digitalWrite(13, LOW); // sets the LED off
delay(100);
digitalWrite(13, HIGH); // sets the LED on
delay(200);
//break
digitalWrite(13, LOW); // sets the LED off
delay(400);
//L
//dit
digitalWrite(13, HIGH); // sets the LED on
delay(200);
digitalWrite(13, LOW); // sets the LED off
delay(100);
//dah
digitalWrite(13, HIGH); // sets the LED on
delay(400);
digitalWrite(13, LOW); // sets the LED off
delay(100);
//dit
digitalWrite(13, HIGH); // sets the LED on
delay(200);
digitalWrite(13, LOW); // sets the LED off
delay(100);
//dit
digitalWrite(13, HIGH); // sets the LED on
delay(200);
//break
digitalWrite(13, LOW); // sets the LED off
delay(400);
//O
//dah
digitalWrite(13, HIGH); // sets the LED on
delay(400);
digitalWrite(13, LOW); // sets the LED off
delay(100);
//dah
digitalWrite(13, HIGH); // sets the LED on
delay(400);
digitalWrite(13, LOW); // sets the LED off
delay(100);
//dah
digitalWrite(13, HIGH); // sets the LED on
delay(400);
//word break
digitalWrite(13, LOW); // sets the LED off
delay(1600);
//W
//dit
digitalWrite(13, HIGH); // sets the LED on
delay(200);
digitalWrite(13, LOW); // sets the LED off
delay(100);
//dah
digitalWrite(13, HIGH); // sets the LED on
delay(400);
digitalWrite(13, LOW); // sets the LED off
delay(100);
//dah
digitalWrite(13, HIGH); // sets the LED on
delay(400);
//break
digitalWrite(13, LOW); // sets the LED off
delay(400);
//O
//dah
digitalWrite(13, HIGH); // sets the LED on
delay(400);
digitalWrite(13, LOW); // sets the LED off
delay(100);
//dah
digitalWrite(13, HIGH); // sets the LED on
delay(400);
digitalWrite(13, LOW); // sets the LED off
delay(100);
//dah
digitalWrite(13, HIGH); // sets the LED on
delay(400);
//break
digitalWrite(13, LOW); // sets the LED off
delay(400);
//R
//dit
digitalWrite(13, HIGH); // sets the LED on
delay(200);
digitalWrite(13, LOW); // sets the LED off
delay(100);
//dah
digitalWrite(13, HIGH); // sets the LED on
delay(400);
digitalWrite(13, LOW); // sets the LED off
delay(100);
//dit
digitalWrite(13, HIGH); // sets the LED on
delay(200);
//break
digitalWrite(13, LOW); // sets the LED off
delay(400);
//L
//dit
digitalWrite(13, HIGH); // sets the LED on
delay(200);
digitalWrite(13, LOW); // sets the LED off
delay(100);
//dah
digitalWrite(13, HIGH); // sets the LED on
delay(400);
digitalWrite(13, LOW); // sets the LED off
delay(100);
//dit
digitalWrite(13, HIGH); // sets the LED on
delay(200);
digitalWrite(13, LOW); // sets the LED off
delay(100);
//dit
digitalWrite(13, HIGH); // sets the LED on
delay(200);
//break
digitalWrite(13, LOW); // sets the LED off
delay(400);
//D
//dah
digitalWrite(13, HIGH); // sets the LED on
delay(400);
digitalWrite(13, LOW); // sets the LED off
delay(100);
//dit
digitalWrite(13, HIGH); // sets the LED on
delay(200);
digitalWrite(13, LOW); // sets the LED off
delay(100);
//dit
digitalWrite(13, HIGH); // sets the LED on
delay(200);
//final break
digitalWrite(13, LOW); // sets the LED off
delay(3200);
}