I cannot read from RS232 to arduino mega

I have a boot cell tied to http://us.ohaus.com/en/home/products/product-families/T3P-US.aspx that has an RS232 interface. The interface works great with PC (9600 8N1). I configure it to record the weights every second and it shows up in the hyperterminal.

On the other hand, I have an arduino mega board with this module http://www.lightinthebox.com/es/rs232-puerto-serie-para-modulo-convertidor-ttl-para-arduino-con-transmitir-y-recibir -indicador_p1141433.html Again, it works correctly from PC with this code:

void setup() {
  // initialize serial:
  Serial1.begin(9600);

  Serial.begin(9600);
  Serial.println("Hello Computer");
}

void loop() {
  while (Serial1.available()) {
    Serial.println(Serial1.read());
    delay(200);
  }
  while (Serial.available()) {
    Serial1.println(Serial.read());
    delay(200);
  }
  delay(1000);
}

      

Then I use a male to male adapter to connect both, since both have female connections and use the same code. And it doesn't work at all. Serial1.available () never gets greater than 0. TX from RS232 module connects to RX1 (19), RX to TX1 (18), vcc to 5V and gnd to arduino gnd.

+3


source to share





All Articles