Serial.setTxBit()

Guys, I'm trying to use the Serial.setTxBit() function for the TX pin on ATtiny85 with ATtinyCore but the TX pin doesn't change, it always stays on PB0.

void setup() {
 Serial.setTxBit(2);
   Serial.begin(9600);

  
  delay(100);
}

void loop() {

  if (Serial.available() > 0) {
    String receivedString = Serial.readString();  
    
  
    if (receivedString == "Hello") {
      // Envia a mensagem "World!!!" pela comunicação serial
      Serial.println("World!!!");
    }
  }
  
}

There's an error in the TinySoftwareSerial.cpp file of the core you use:

void TinySoftwareSerial::setTxBit(uint8_t txbit)
{
  _txmask=_BV(txbit);
  _txunmask=~txbit;
}

The second line of the routine should read:

_txunmask=~_txmask;

Has this information already been reported to the core development?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.