Welcome Guest 

Show/Hide Header

Welcome Guest, posting in this forum requires registration.





Pages: [1]
Author Topic: A little bit of Arduino.
jonadmin
Administrator
Posts: 5
Permalink
Post A little bit of Arduino.
on: August 31, 2013, 15:00
Quote

So, I got my first Arduino board, a UNO, on Friday (Thanks Etang Electronics via eBay), costing s smidge under a tenner.

Today was the first time I had to play with it, and the results were good. The free IDE software, downloaded from the main Arduino site here: <a href="http://arduino.cc/en/" target="_blank">Arduino on the web</a> is simple and easy to use, and getting my first program uploaded and running was extremely easy.

As a first shot, I simply took some example code from the site, and modified to do my bidding.

The goal was to make the onboard LED flash 'SOS', wait 4 seconds, and repeat. My code is below, as it's good to share 🙂

Go get an Arduino folks, and make stuff, the number of sensors etc is AMAZING! I can see me spending some time with it in the not too distant future.

/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.

This example code is in the public domain.
*/

// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;

// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
digitalWrite(led, LOW);
}

// the loop routine runs over and over again forever:
void loop() {
//Signalling SOS with on-board LED
//First S
digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
delay(250);               // wait for a second
digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
delay(250);               // wait for a quarter second

digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
delay(250);               // wait for a second
digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
delay(250);               // wait for a quarter second

digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
delay(250);               // wait for a quarter second
digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
delay(500);               // wait for a half second before moving on to O
//Then O
digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
delay(1000);               // wait for a second
digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
delay(1000);               // wait for a second

digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
delay(1000);               // wait for a second
digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
delay(1000);               // wait for a second

digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
delay(1000);               // wait for a second
digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
delay(500);               // wait for a half second before moving on to the last S
//Finally S again
digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
delay(250);               // wait for a quarter second
digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
delay(250);               // wait for a quarter second

digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
delay(250);               // wait for a quarter second
digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
delay(250);               // wait for a quarter second

digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
delay(250);               // wait for a quarter second
digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
delay(4000);               // wait for 4 seconds before looping again
}

Pages: [1]
Mingle Forum by cartpauj
Version: 1.0.34 ; Page loaded in: 0.089 seconds.