tech.anurag01
New member
Hello all,
I was trying to explore how to use the setTX() and setRX() functions using teensy4.0.
from the following link: https://www.pjrc.com/teensy/td_uart.html , i got the information that I can use pins 1, 2, 3, 4, 5, 7, 8, 30, 31, 32, 33 and 0, 34, 35, 36, 37, 38, 39 as alternate RX pins for Serial1. I have written the following two programs and uploaded them on two teensy 4.0's.
1st Program uploaded on the 1st teensy:
2nd Program uploaded on the second teensy:
I have connected pin 1 (TX for Serial1) of the second teensy to pin 4 of the first teensy. I was expecting teensy 1 to print 'a' to the terminal, but it did not happen.
When I connected the wire to pin0 (default RX for Serial1) it started printing 'a' to the console. This means that the RX pin of Serial1 has not been re-configured to pin 4.
Could someone point out the mistake that I have done in my code or point me in the right direction?
Additionally, as per the link that I shared above, the TX pins in teensy 4.0 don't have any alternate pins and hence the setTX() function is of no use in teensy4.0. Am I correct?
Thank you
I was trying to explore how to use the setTX() and setRX() functions using teensy4.0.
from the following link: https://www.pjrc.com/teensy/td_uart.html , i got the information that I can use pins 1, 2, 3, 4, 5, 7, 8, 30, 31, 32, 33 and 0, 34, 35, 36, 37, 38, 39 as alternate RX pins for Serial1. I have written the following two programs and uploaded them on two teensy 4.0's.
1st Program uploaded on the 1st teensy:
Code:
char input;
void setup()
{
Serial1.setRX(4);
Serial.begin(9600);
Serial1.begin(9600);
}
void loop()
{
if (Serial1.available() > 0)
{
input = Serial1.read();
Serial.println(input);
}
if (Serial.available() > 0)
{
input = Serial.read();
Serial.println(input);
}
}
2nd Program uploaded on the second teensy:
Code:
void setup()
{
Serial1.begin(9600);
}
void loop()
{
delay(1000);
Serial1.print('a');
}
I have connected pin 1 (TX for Serial1) of the second teensy to pin 4 of the first teensy. I was expecting teensy 1 to print 'a' to the terminal, but it did not happen.
When I connected the wire to pin0 (default RX for Serial1) it started printing 'a' to the console. This means that the RX pin of Serial1 has not been re-configured to pin 4.
Could someone point out the mistake that I have done in my code or point me in the right direction?
Additionally, as per the link that I shared above, the TX pins in teensy 4.0 don't have any alternate pins and hence the setTX() function is of no use in teensy4.0. Am I correct?
Thank you