4 Button Input Key Fob

Hi, I am working on a project that involves the use of a key fob to control 4 LED’s (I am working on eventually integrating a stepper motor and a servo, 2 keys each, with the keys controlling the rotational direction). My knowledge is very limited as far as coding and circuitry. I found a code for the fob online and the code will upload, but when I press the keys, nothing happens. I am not sure if it is the code or my circuit that is causing any errors in the functionality.

Please help.

I have added the code and attached an image of the circuit below.

If there is anything else you need me to add let me know.

From: https://www.electronics-micros.com/software-hardware/simple-wireless-remote-control-for-the-arduino/

Digital Input / Output using standard programming techniques


  • Input A connected in pin A0
  • Input B connected in pin A1
  • Input C connected in pin A2
  • Input D connected in pin A3
  • Output W connected to pin Arduino 3
  • Output X connected to pin Arduino 5
  • Output Y connected to pin Arduino 6
  • Output Z connected to pin Arduino 9


// Use constants to set pin numbers

const int inputA = A0; // Input A
const int inputB = A1; // Input B
const int inputC = A2; // Input C
const int inputD = A3; // Input D
const int outputW = 3; // Output W
const int outputX = 5; // Output X
const int outputY = 6; // Output Y
const int outputZ = 9; // Output Z

// Use variables for values that will change:
int readState = 0; // Variable for reading the input status

void setup() {

// Setup inputs:
pinMode(inputA, INPUT);
pinMode(inputB, INPUT);
pinMode(inputC, INPUT);
pinMode(inputD, INPUT);

// Setup outputs:
pinMode(outputW, OUTPUT);
pinMode(outputX, OUTPUT);
pinMode(outputY, OUTPUT);
pinMode(outputZ, OUTPUT);

void loop() {
// Read the state of the first input value:
readState = digitalRead(inputA);

if (readState == HIGH) {
// turn LED on:
digitalWrite(outputW, HIGH);
else {
// turn LED off:
digitalWrite(outputW, LOW);

// Read the state of the second input value:
readState = digitalRead(inputB);

if (readState == HIGH) {
// turn LED on:
digitalWrite(outputX, HIGH);
else {
// turn LED off:
digitalWrite(outputX, LOW);

// Read the state of the third input value:
readState = digitalRead(inputC);

if (readState == HIGH) {
// turn LED on:
digitalWrite(outputY, HIGH);
else {
// turn LED off:
digitalWrite(outputY, LOW);

// Read the state of the fourth input value:
readState = digitalRead(inputD);

if (readState == HIGH) {
// turn LED on:
digitalWrite(outputZ, HIGH);
else {
// turn LED off:
digitalWrite(outputZ, LOW);

OP’s pic:


The easiest way to test those things is with your voltmeter and no Arduino involved except to provide 5V and ground to the receiver. Just use the meter to to see what happens on the receivers’s outputs as you press the keys, with 5V and Gnd supplied from Arduino.

I have one of the momentary ones (there are three models iirc) and it mysteriously stopped working. I have no idea why but they do seem a little fragile.