ATtiny45 - Aruidno Uno R3 - Computer USB | serial print not human readable

I programmed an ATtiny45 using ArduinoISP.
The LED flashes.

Then I connected tx from ATtiny45 to rx on Arduino and hoped I could see serial print on the computer. (Not sure this is the correct hope.)

On the Arduino program, in serial monitor, I get unreadable characters and they are all in one line.

I tried dividing the tx line from ATtiny using 220k and 100k Ohm resistors, too. It didn’t work. (Not sure this is a thing you should do.)

Below is the program:

#include <SoftwareSerial.h>

#define LEDPin 2
#define ADCPin 5

#define txPin 1
#define rxPin 0

SoftwareSerial mySerial(rxPin, txPin);

int adcVal;

void setup() {

pinMode(LEDPin, OUTPUT);
pinMode(ADCPin, INPUT);

// pinMode(rxPin, INPUT);
// pinMode(txPin, OUTPUT); //Maybe needed. Try and see.
mySerial.begin(9600);
}

void loop() {
adcVal = analogRead(ADCPin);
digitalWrite(LEDPin, HIGH);
delay(200);
digitalWrite(LEDPin, LOW);
delay(300);
mySerial.print(adcVal);
mySerial.println();
}

Thanks.

Question #2 is if you can use an FTDI adapter to program ATtiny, can you use it to let the computer know the serial print?
Thanks.

Baud rate mismatch, or you haven't connected the grounds.

Ground on Tiny45 must be tied to ground on the thing it's communicating with.

Assuming it's not that, it's (almost certainly) baud rate mismatch... What ATTiny core are you using?

Have you done Burn Bootloader to set the clock speed (even though the ATTiny45 doesn't have a bootloader, you still must do this to set it to run at the correct speed, otherwise all the timing, including UART baud, will be hopelessly wrong.

Resistor dividers should be lower value resistance, and should only be used when the two devices have a different operating voltage.

Have you tuned the internal oscillator on the ATTiny, or are you using a crystal? If you have not done either, it may be that the internal oscillator is too far off from 8mhz for UART communication. Try nudging the baud rate in the sketch higher or lower in units of like... 200 (2%); The factory calibration on the UART is only +/- 10%, and you need it a lot closer than that for UARTs to work - yet in my personal experience, I've never been able to test a calibration sketch on an '85 or '84 - they were all good enough to do serial out of the box.

Thanks. All of them are helpful.

I burned a bootloader using Arduino IDE. I don't know which one got in. I selected 1 MHz and ATtiny45. The two grounds are connected.

I will try mySerial.begin(9400) and (9800).

One more question: is it true if the bootloader wasn't the one and the LED could still blink well? Thanks.

Try at 8 mhz, burn bootloader again so it runs at 8, and try again. I don't think software serial can do 9600 baud at 1mhz.

Unless you have a good reason otherwise, run chips using the off internal oscillator at 8mhz, not 1.