Where to Start, Program or Wiring?

ddoc : I want to jump in here before you start connecting wires.

if you are a total beginner, and you expect to do more than a few projects, you would need to get a bunch of parts. all free shipping from China and at one $1 per bag, it is not too hard on the wallet.

get some 10,000 ohm, or 10k resistors
1k and 330 ohm.
bags of 100 should be in that $1-$2 range and you will use these most of all.

read up on voltage dividers. one 10k connected to your 12v and a pair of 10k twisted togther (parallel) would make one 5k resistor. connect the 5k to ground and then connect your wire and the loose end of the 10k and 5k and you would have 4 volts. this is great for the input of any digital pin.

load the blink sketch and play with timing (one of the examples in the IDE software)
there is one for switchs too.

you can output from any digital pin to an LED and then to a 330 ohm to ground for an indicator. this will allow you to have some outputs you can see, and some inputs from switches.

a color assortment of LEDs would less than $1 from aliexpress

one beginners tip is that if you can turn an LED on and off as you want, when you want and as often or as slow as you want, you can control pretty much anything that can be turned on and off. so, your LED is a way to bench test if your sketch is working properly.

second, a pen and a paper allows you to sketch out a circuit, scan it, then post it here for us to review. a simple sketch does magic for both you and us. often easier than trying to do it in software. many of us do that when we start projects.

lastly, but most important, read the how to use this forum about posting your code. and search on posting pictures. you can post a link, but we would prefer you embed your photo into your post, it is a two step process.

as a final note, on the bottom right of your posts, there is an edit and modify button. sometimes they come in handy.

@dave-in-nj... perfect suggestions.

OP: When you think of something you’d like to develop, break it into smaller pieces...
e.g. press a button turn on a LED, then press another button, turn it off.
Examine this as two separate functions that must operate independently

  1. detect button presses under any conditions.
  2. turn the output on/ off under any conditions.
    Use Serial.print() to keep track of variables on the serial monitor.

When you have these two concepts working, tie them together - possibly as little as one line of added code!

Thanks all for the replies and very useful tips.

I can confirm that I am a complete beginner with this - not had a chance to respond the past couple of days due to reading quite a bit either here or at Sparkfun, learning lots.

I do have lots of bits and pieces, more than enough to start tinkering however, my aim is to complete my switch box of which I am now revisiting the switches I have purchased previously to really try and understand how I should specify the correct rated switches ditto the LED - I'm trying to incorporate ohms law to aid in specifying. I have picked up a multimeter but not fully sure what I should be measuring to be able to specify a switch.

With regard to Fritzing and its usefulness, I have found the breadboard view to be informative and helpful as a visual aid to me. I have looked at the Schematics tab and used the autoroute function as well as manually placing the components to convey the message better - My background is as a Carpenter though, I am currently employed as a 3D Draughtsman producing models of steel buildings for manufacture so, while I do not appreciate the wealth of electrical components and their properties\functions, 2D diagrams or schematics are far from an alien concept to me.

Anyway, whilst reading and thinking on my project, I realise that my initial statements concerning the use of a single green LED in my project will have to be re-thought as I do not believe it is going to work the way I envisioned.

None of my five switches have anything to do with the LED, the LED is independent of the switches. While the switches are to have keybinds from within the sim my intention is to have the LED operated by a specific key press so, for instance combination Alt Delete will illuminate the LED then Alt Delete again to turn it off - I believe these specific keys would need to be declared in the code for the LED?

My assumption is that this is possible?

With regard to the five switches, I already have some code for these albeit it needs to be edited to suit my switches and arduino inputs which I will do once I am happy with what connections I select.

The following code is the basis from what I will be working from

/*

  This code is for a teensy 3.1 used in my green russian control board
  You must select the teensy board in Tools and change USB Type to Joystick

*/


//How many buttons I'm using, must equal amount of values in following array
#define NUM_BUTTONS 14  
//Which pins I have attached to my buttons
int buttonList[NUM_BUTTONS] = {2,3,4,5,6,7,8,9,10,11,12,14,15,16};

//Led intensity, so super bright LEDS aren't shining in our eyes
#define INTENSITY 200


void setup() {
  //This makes it so the states are send by us manually
  Joystick.useManualSend(true);
  
  //Declare button pins as input with the internal pullup resistor on
  for (int i = 0; i < NUM_BUTTONS; i++)  {
    pinMode(buttonList[i], INPUT_PULLUP);
  }
  
  //Declare our LED pins as outputs
  pinMode(17, OUTPUT);
  pinMode(18, OUTPUT);
  pinMode(19, OUTPUT);
  pinMode(20, OUTPUT);
}


void loop() {
  //Read our analogue pots
  //Remember that the analogue pin numbers are different than the digital ones!
  Joystick.sliderLeft(analogRead(7));
  Joystick.sliderRight(analogRead(8));
  
  //Read our button states
  for (int i = 0; i < NUM_BUTTONS; i++) {
    if (digitalRead(buttonList[i]) == HIGH) {  //Check to see if pin is HIGH
      Joystick.button(i + 1, 0);  //If pin is HIGH, button isn't pressed, so send 0
    } else {
      Joystick.button(i + 1, 1);  //If pin is LOW, button is pressed, so send 1
    }
  }
  
  
  //Special case for LED status lights
  //Check status of button and change LED accordingly
  
  if (digitalRead(12) == LOW)  //Check if button is pressed/switch flipped
    analogWrite(17, INTENSITY);  //Set corresponding LED pin to intensity level  
    else 
    analogWrite(17, 0);  //Otherwise turn off
  
  if (digitalRead(7) == LOW)  //Same for other pins
    analogWrite(18, INTENSITY);
    else
    analogWrite(18, 0);
  
  if (digitalRead(9) == LOW) 
    analogWrite(19, INTENSITY);
    else
    analogWrite(19, 0);
  
  if (digitalRead(11) == LOW) 
    analogWrite(20, INTENSITY);
    else
    analogWrite(20, 0);
  
  Joystick.send_now();  //Send control states
  delay(5);  //Slow things down a bit
}

My example above wasn’t for your specific project, but a methodology to avoid getting yourself tangled up as it grows!

lastchancename:
My example above wasn’t for your specific project, but a methodology to avoid getting yourself tangled up as it grows!

I believe that what I am trying to achieve is not difficult however, I will be taking your advice and I will be wiring a single switch and attempt to code it. I intend to do this with the LED too.

Once I'm happy that I understand what is doing what I will then look to combine the switches and the LED in code.

Dave.