AllanSouth69

#include <RF24.h>

#define radioID 0

struct estruturaDadosRF
{
boolean ligando = false;

boolean A = false;
boolean B = false;
boolean C = false;
boolean D = false;
int potY = 0;
int valorY = 0;

};
typedef struct estruturaDadosRF tipoDadosRF;
tipoDadosRF dadosRF;
tipoDadosRF dadosRecebidos;

boolean transmitido = true;
boolean alterado = false;

RF24 radio(9, 10);

byte enderecos[6] = {“1node”,“2node”};

boolean AAnt = HIGH;
boolean A = HIGH;
boolean BAnt = HIGH;
boolean B = HIGH;
boolean CAnt = HIGH;
boolean C = HIGH;
boolean DAnt = HIGH;
boolean D = HIGH;

int YAnt = 0;
int Y = 0;
int valorYAnt;
int valorY;

int variavel;

void Setup() {

radio.setPALevel(RF24_PA_MAX);
radio.setDataRate(RF24_250KBPS);

radio.begin();

#if radioID == 0
radio.openWritingPipe(enderecos[0]);
radio.openReadingPipe(1, enderecos[1]);
#else
radio.openWritingPipe(enderecos[1]);
radio.openReadingPipe(1, enderecos[0]);
#endif

dadosRF.ligando = true;
radio.stopListening();
long tempoInicio = millis();
while ( !radio.write( &dadosRF, sizeof(tipoDadosRF) ) ) {
if ((millis() - tempoInicio) > 2000) {
break;
}
}
dadosRF.ligando = false;
radio.startListening();

if (radioID == 0); {

pinMode(3, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(9, OUTPUT);
pinMode(13, OUTPUT);
}
if (radioID == 1) {

pinMode(A1, INPUT);
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
pinMode(4, INPUT_PULLUP);
pinMode(5, INPUT_PULLUP);
pinMode(13, OUTPUT);
pinMode(A1, INPUT);
}
}

void Loop() {

if (alterado || !transmitido) {
radio.stopListening();
transmitido = radio.write( &dadosRF, sizeof(tipoDadosRF) );
radio.startListening();
alterado = false;
}

if (radio.available()) {
radio.read( &dadosRecebidos, sizeof(tipoDadosRF) );

if (dadosRecebidos.ligando) {
alterado = true;
} else {
dadosRF = dadosRecebidos;
}
}

#if radioID == 1
Y = analogRead(A1);
if (Y != YAnt) {
dadosRF.potY = Y;
alterado = true;
}
YAnt = Y;

#endif

A = digitalRead(2);
if (A && (A != AAnt)) {
dadosRF.A = !dadosRF.A;
alterado = true;
}
AAnt = A;

B = digitalRead(3);
if (B && (B != BAnt)) {
dadosRF.B = !dadosRF.B;
alterado = true;
}
BAnt = B;

C = digitalRead(4);
if (C && (C != CAnt)) {
dadosRF.C = !dadosRF.C;
alterado = true;

}
CAnt = C;

D = digitalRead(5);
if (D && (D != DAnt)) {
dadosRF.D = !dadosRF.D;
alterado = true;

}
DAnt = D;

valorY = map(dadosRF.potY, 0, 1023, 0, 255);
if (valorY && (valorY != valorYAnt)) {
dadosRF.valorY = !dadosRF.valorY;
alterado = true;
}
valorYAnt = valorY;

digitalWrite(2, dadosRF.A);
digitalWrite(3, dadosRF.B);
digitalWrite(4, dadosRF.C);
digitalWrite(5, dadosRF.D);

delay(10);

if (radioID == 0) {

if(A == LOW) {
digitalWhite(3, valorY);
digitalWhite(5, LOW);
digitalWhite(6, ValorY);
digitalWhite(9, LOW);
}

if (B == LOW) {
digitalWhite(3, LOW);
digitalWhite(5, valorY);
digitalWhite(6, valorY);
digitalWhite(9, LOW);
}

if (C == LOW) {
digitalWhite(3, LOW);
digitalWhite(5, valorY);
digitalWhite(6, LOW);
digitalWhite(9, valorY);
}

if (D == LOW) {
digitalWhite(3, valorY);
digitalWhite(5, LOW);
digitalWhite(6, LOW);
digitalWhite(9, valorY);
}

// desligar tudo
digitalWhite(3, LOW);
digitalWhite(5, LOW);
digitalWhite(6, LOW);
digitalWhite(9, LOW);

digitalWhite(13, LOW);

}

Hi @AllanSouth. Did you have a question, or did you just want to share your sketch?

AllanSouth:

void Setup() {

Arduino programming language/C++ is case sensitive Setup != setup. Please read this:
https://www.arduino.cc/reference/en/language/structure/sketch/setup/

void Loop() {

Same here, Loop != loop. Please read this:
https://www.arduino.cc/reference/en/language/structure/sketch/loop/

      digitalWhite(3, valorY);

Did you maybe mean digitalWrite instead of digitalWhite? Please read this:
https://www.arduino.cc/reference/en/language/functions/digital-io/digitalwrite/