Go Down

Topic: Seeing TX Pin On Serial Monitor while Sending Data (Read 1 time) previous topic - next topic

kycn

Hi all,

I am using Arduino Leonardo (ATMega32U4). I want to see sending data over TX pin in Serial Monitor while it sending manchester encoding data. I just used the codes and libraries which is https://github.com/mchr3k/arduino-libs-manchester to manchester encoding. The problem is when i tried several approaches, i could not see the manchester encoded data in the Serial Monitor so i am not sure this code is working. Can you help me? Thank you for your replies. My codes and Serial Monitor writings:

Code: [Select]

#include <Manchester.h>
#define TX_PIN 1

uint8_t transmit_data = 0b00000110;

void setup() {
  Serial.begin(1200);
  // put your setup code here, to run once:
  man.setupTransmit(TX_PIN,MAN_1200);
}

void loop() {
  // put your main code here, to run repeatedly:
  man.transmit(transmit_data);
  int r = digitalRead(TX_PIN);
  Serial.println(r);
}


Serial Monitor output is always 0.

Code: [Select]

#include <Manchester.h>
#define TX_PIN 1

uint8_t transmit_data = 0b00000110;

void setup() {
  Serial1.begin(1200);
  // put your setup code here, to run once:
  man.setupTransmit(TX_PIN,MAN_1200);
}

void loop() {
  // put your main code here, to run repeatedly:
  man.transmit(transmit_data);
  int r = digitalRead(TX_PIN);
  Serial1.println(r);
}


No Serial Monitor output.

PaulRB

Hi,

On Leonardo/Pro Micro etc, "Serial.print()" sends to the serial monitor on your pc. "Serial1.print()" sends to the TX pin. So your second sketch is sending nothing to serial monitor. In your first sketch, you are not reading from the TX pin until after the manchester encoded data has finished sending, so you always see zero (or maybe the last bit of the encoded data or a check-bit of some kind).

So that is why you see what you see. Question is, what did you want to see and what are you trying to do?

Paul

kycn

Hi again,

First of all, thank you for your reply. As i mentioned in my first post, i want to see the sending TX data if it is a really manchester encoded data or not. For example, while my transmit data is 0b0110, i want to see 0b01101001 in Serial Monitor. I want to make sure that this library and this code work correct and also i want to see what i send through the TX pin in the Serial Monitor.

kycn

PaulRB

Ok, i understand. I think you should use either an oscilloscope, or perhaps another Arduino. Another Arduino could run a sketch that behaves like an oscilloscope, sampling a digital input at high speed to capture the waveform coming from the Leonardo.

Certainly, i cannot see how your method could succeed. The same Arduino cannot sample the outgoing waveform without disturbing it.

Grumpy_Mike

On that processor pin 1 is the TX pin of Serial1 not Serial so you are sending nothing to the serial monitor. Even if you were sending something then the serial monitor would just show you the ASCII equivalent of your Manchester encoding. Which would just look like junk.

kycn

Hi again,

I solved this problem with communicate arduino via their TX and RX pins with MSP430G2 (because i have this card -there is not a specific reason to choose this card-) with the help of UART protocol to see the sending bits. Thanks guys.

kycn

Go Up