New to the Forum

Hi all,

I thought I'd say hi before posting any questions and introduce myself.

I'm brand new to Arduino and electronics, however I do have a Computer Science Degree so I've done a bit of programming in my past, that said I've not done any for about 12 years.

I'm planning on starting with the basics but as I spend most of my spare time flying model planes, I'm keen to see if I can move on to something motorised (on the ground) and then on to something capable of flying in the future.

I bought an Arduino Uno, a breadboard and a load of component LEDs and Resistors from Maplin so I'm playing with cycling LEDs via an array and getting my eye back in on the programming :)

Many thanks in advance for advice received, in time I hope to be able to help others.


Hi Dave, welcome.

Good news for you.
There’s a quite large Arduino usergroup that also is into model flight stuff.
So you’ll find that a lot of autopilot systems for mulitcopters are Arduino based.
However, being a starter myself, i’d advice to follow the examples you find with the IDE and right here on the forums.
Feel free to play around, and change those examples to do things just a little different and add or combine examples.
You’ll have no problem “getting the hang of it”.

You’ll be programming your own stuff in no time.

Cool, I was hoping that was the case :slight_smile:

Thanks, I’ve already coded a knight rider light from scratch, then compared it to the one in the Playground and found my one much smoother as it uses Duty Cycle :slight_smile: Is there a way of having it submitted to the Playground so others can make use of it?

// Dave Twilley 2012 (30/12/12)
// Cycles 6 LED's in a KITT Pattern using Pulse Width Modulation (PWM)
// In this example, three LED's will be lit all the time but at different
// Duty Cycles to give us a High, Medium and Low LED this makes the
// motion smoother and more realistic.
// We use an array to store the PINs we will be using and also to store 
// Duty Cycle (PWM), of each PIN which will control the brightness of the
// LED

const int intSpeed = 250;                                                                // Delay between changing LED in ms
const byte byLEDCount = 6;                                                               // Number of LED's in use
const byte byHigh = 255;                                                                 // Set the High PWM value
const byte byMed = 30;                                                                   // Set the Med PWM value
const byte byLow = 10;                                                                   // Set the Low PWM value
boolean blDirection = false;                                                             // Set the initial direction of the lights, true = down the array

int arLED[byLEDCount][2] = {{11,0},{10,0},{9,0},{6,0},{5,0},{3,255}};                    // Define PWM PINs for LEDs as 11, 10, 9, 6, 5 & 3 plus define initial PWM
int intPosition = 6;                                                                     // Set the starting LED, this keeps track of the lead LED, ie. the brightest one

void setup()
  // Run through the array with a for loop and setup the PIN we wish to use on the Arduino
  for (byte loopCounter = 0; loopCounter < byLEDCount; ++loopCounter) {
    pinMode (arLED[loopCounter][0],OUTPUT);

void loop()
   // Run through the array with a for loop and set the output PINS to the values found in the array
  for (byte loopCounter = 0; loopCounter < byLEDCount; ++loopCounter) {
    analogWrite (arLED[loopCounter][0],arLED[loopCounter][1]);
    if (arLED[loopCounter][1] == byLow) {arLED[loopCounter][1]=0;}                      // Test to see if this LED was on LOW before, if so, turn it off
    else if (arLED[loopCounter][1] == byMed) {arLED[loopCounter][1] = byLow;}           // Test to see if this LED was on MED before, if so, set it to LOW
    else if (arLED[loopCounter][1] == byHigh) {arLED[loopCounter][1] = byMed;}          // Test to see if this LED was on HIGH before, if so, turn it MED
  } // end for
  delay(intSpeed); //Delays for the timespecified in the global speed constant

  if (blDirection) {intPosition++;} else {intPosition--;}                               // If we're going down the array then incremement the position variable
  arLED[intPosition-1][1]=byHigh;                                                       // Set the LED to be the brightest in our array based on our current position
  if (intPosition == byLEDCount) {blDirection=false;} else if (intPosition == 1) {blDirection=true;}      // Check to see if we're at either end of the array, if we are reverse our direction