Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ayuda con configuración de pines rs485
#1
Me pueden ayudar con la configuración en el mismo código de Arduino, el cambio de.pines del rs485 y scl ya que tengo otras tarjetas que programo y no quiero estar moviendo ese dato desde la configuración de Arduino ide, gracias
Reply
#2
can you write in English? i don't understand your words.
Reply
#3
(09-10-2024, 04:07 AM)admin Wrote: can you write in English? i don't understand your words.

Can you help me, I need the scl and sda pins to be configured dynamically within my Arduino code, since I have other cards that I program and I don't want to be moving that data from the configuration that you recommend in the image path, thank you


Attached Files Image(s)
   
Reply
#4
sure, you can also set the SDA,SCL pins in arduino source code.
Reply
#5
al final puse la configuracion recomendada cambiando los datos de rs485 en HardwareSerial.cpp , pines 14 y 27, adicional deje en mi codigo la configuracion de pines no se si eso tambien funcione sin configurar en el archivo cpp, de cualquier forma dejo el fragmento de codigo donde indica los pines dinamicamente en el ino

const uint32_t TiempoEsperaWifi = 5000;
#define RXD2 14
#define TXD2 27

String relaystate[16]={"relay1state","relay2state","relay3state","relay4state",
"relay5state","relay6state"
};
String relay1state = "off";// state of relay1
String relay2state = "off";// state of relay2
String relay3state = "off";// state of relay3
String relay4state = "off";// state of relay4
String relay5state = "off";// state of relay5
String relay6state = "off";// state of relay6

unsigned long timeElapsed;

String url = "http://74.208.53.203/index3.php";


void setup() {
Serial.begin(9600);
Serial.println("\nIniciando multi Wifi");


// Set PCF8574 pinMode to OUTPUT
for(int i=0;i<=5;i++)
{
pcf8574_R1.pinMode(i, OUTPUT);
}

pcf8574_R1.begin();

pcf8574.pinMode(P0, INPUT);
pcf8574.pinMode(P1, INPUT);
pcf8574.pinMode(P2, INPUT);
pcf8574.pinMode(P3, INPUT);
pcf8574.pinMode(P4, INPUT);
pcf8574.pinMode(P5, INPUT);
pcf8574.pinMode(P6, INPUT);
pcf8574.pinMode(P7, INPUT);

Serial.print("Init pcf8574...");
if (pcf8574.begin()){
Serial.println("OK");
}else{
Serial.println("KO");
}

Serial2.begin(9600, SERIAL_8N1, RXD2, TXD2);

gracias
Reply
#6
ok
Reply


Forum Jump:


Users browsing this thread: