key fob programming

Hi all I am very new to Arduino My wife is registered blind and i have built and programmed a small project to turn on some entry lights from a 4 button key fob using simple rx tx fs100a pair. My problem is key fob sends out -622 code for every button. Receiver accepts code no problem and works but i have tried to program key fob with deferent codes so i can control more lights with each button Tried to program fob with tx unit and Arduino but fob will not accept back the -622 code eccept from other fob. Thankfully I have another remote with same code so project ok, If could you please advise, and what does the - part of code mean Thank you

what does the - part of code mean

The - part of what code?

from a 4 button key fob using simple rx tx fs100a

But, you are not going to share which one. Well, OK, be that way.

My problem is key fob sends out -622 code for every button.

I rather doubt that.

Receiver accepts code no problem

What receiver?

Hellow and thank you for reply I explaned I am very new to ardino. I am not not willing to share as you suggest and probably sound stupid to you but I thouhht I would get understanding anf help not short sited criticism The part of the code is the minus sine of the -622 value recieved by rc switch library And what I need to do in arduino code to programm fob

PaulS’s tone is harsh, but his comments are almost always correct. In this case, he’s right on - you’ve provided very little information of the type we’d need to help you.

If you’re seeing the same code from every button - that doesn’t make sense, does it? If it sent the same code for every button, it wouldn’t be able to tell which button was which. More likely, it’s sending something that “almost” looks like a code that the rcswitch library uses, and produces that code - but it’s not actually the same, and is just confusing rcswitch into producing that. That’s what I suspect at first glance. I don’t know though - since you’ve given us virtually nothing to go off of.

Hi I have purchased 2 key fobs and programmed uno with rc switch to print out value and turn on FET to turn on the lights. the code that is printed is -622. this is the same for all 4 buttons and will turn on and off the FET with each press of any of the four buttons. Both key fobs are exactly the same. I programmed another uno as transmitter to transmit -622 to test and this works fine and turns Fet on and off have changed code on tx to check and it does not work so i am assuming code works ok both fobs operate light circuit correctly and circuit will not operate on any code other than -622 when i tried to program 1 fob with different code from uno tx following instructions from fob data it would not accept code so had to re- program fob with other fob and this worked fine and all for buttons send -622 and operate circuit correctly. these fobs have been programmed with the same code by manufacturers so i assume that i cannot just send -622 from uno to program a button in its leaning mode. I am sorry if this sounds confusing but its true your sincerely joatmonpap

It's past time for you to post a link to the key fob that you are trying to interact with, and the code that interacts with that key fob.

#include <RCSwitch.h>
// #include <JeeLib.h>

RCSwitch mySwitch = RCSwitch();
const int ledPinD = 4;
const int ledPin = 13;

void setup() {

pinMode(ledPinD, OUTPUT); // output to drive fet
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, LOW); // turn off pin 13 led
// to save battery power
mySwitch.enableReceive(0); // Receiver on inerrupt 0 => that is pin #2

void loop() {
if (mySwitch.available()) {

int value = mySwitch.getReceivedValue();
if (value == -622)
{digitalWrite(ledPinD, !digitalRead(ledPinD));

if (digitalRead(ledPinD) == LOW)
Serial.println(" LIGHTS OFF ");

else{ Serial.println(" LIGHTS ON "); }}


Only half complying with the request and the code is posted incorrectly. Why will you not read the how to use this forum page?

The code is bad, braces where ther is no need and no braces where ther is need. You also need to post links the the library you are using.

No cooperation no help because simply we can't help.


Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Can you please post a copy of your sketch, using code tags?
They are made with the </> icon in the reply Menu.
See section 7,148850.0.html

Thanks… Tom… :slight_smile: