5 Replies Latest reply on Dec 30, 2014 9:17 AM by Yisus

    Is the Serial2 port really working?

    Yisus

      Hi, i'm trying to use the Serial2 port to send and receive data but it doesn't work, I don't need the Linux console I just need it to send data through the 3.5mm jack, let me show you the code:


      char clave[6];

       

       

      void setup(){

        Serial.begin(9600);

        system("atty -F /dev/ttyS1 9600 cs8 par=even -cstopb"); // I need the parity even so I put it by console, is it right?

        clave[0] = 0x02;

        clave[1] = 0x49;

        clave[2] = 0x30;

        clave[3] = 0x58;

        clave[4] = 0x03;

        clave[5] = 0x22;

      }

       

       

      void loop(){

        Serial2.print(clave);

        Serial.print(clave);

        if (Serial2.available() > 0){

          char caracter = (char)Serial2.read();

          Serial.print(caracter);

        }

        delay(3000);

      }


      i'm sending it to Serial to watch it in the serial monitor but it doesn't work in the other port, it should send me an answer if it receives data but it doesn't do it, i don't know what to do, any help?