Topic: Indicador de estado de entrada
Cordial saludo
Estoy realizando una aplicacion en la que un LED cambie de color si la entrada 5 del arduino uno es alto, pero al momento de utilizar la interfaz despues de descargar el codigo, el led en la pantalla del telefono no cambia de color .
Qué puede ser?
El código es el siguiente:
Best regard
I am making an application in which an LED changes color if input 5 of the arduino uno is high, but when using the interface after downloading the code, the LED on the phone screen does not change color.
What can be?
The code is the following:
//////////////////////////////////////////////
// RemoteXY include library //
//////////////////////////////////////////////
// RemoteXY select connection mode and include library
#define REMOTEXY_MODE__SOFTSERIAL
#include <SoftwareSerial.h>
#include <RemoteXY.h>
// RemoteXY connection settings
#define REMOTEXY_SERIAL_RX 2
#define REMOTEXY_SERIAL_TX 3
#define REMOTEXY_SERIAL_SPEED 9600
// RemoteXY configurate
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =
{ 255,0,0,1,0,13,0,13,13,1,
70,40,27,26,9,9,26,37,135,136 };
// this structure defines all the variables and events of your control interface
struct {
// output variables
uint8_t led_1_r; // led state 0 .. 2
// other variable
uint8_t connect_flag; // =1 if wire connected, else =0
} RemoteXY;
#pragma pack(pop)
/////////////////////////////////////////////
// END RemoteXY include //
/////////////////////////////////////////////
const int BOTON = 5; //Se declara la variable BOTON tipo entero que corresponde al pin 5
const int SALIDA = 6; //Se declara la variable SALIDA tipo entero que corresponde al pin 6
int ENTRADA; //Se declara la variable ENTRADA tipo entero que almacenará el valor que se lea en el pin 5
void setup()
{
RemoteXY_Init ();
Serial.begin(9600); // configura el puerto serie a 9600bps
pinMode(SALIDA,OUTPUT); // configura el pin 6 como salida
pinMode(BOTON,INPUT); // configura el pin 5 como entrada
Serial.println("inicio de programa");
}
void loop()
{
RemoteXY_Handler ();
ENTRADA = digitalRead(BOTON); //El estado del pin 5 se almacena en la variable ENTRADA
if(ENTRADA==1)
{
//digitalWrite(SALIDA,HIGH);
//delay(2000);
RemoteXY.led_1_r = 255;
}
else
{
// digitalWrite(SALIDA,LOW);
RemoteXY.led_1_r = 0;
}
Serial.println(ENTRADA); // envía valor digital de la entrada al monitor serial */
//if (digitalRead(5)==HIGH) RemoteXY.led_1_r = 255;
//else RemoteXY.led_1_r = 0;
}
thanks for your help