UDR0 is 1 byte and float is 4 bytes, it is the matter of size, thank you. However, I tried this code and it worked for int but does not for float again I got question marks
void transmit(unsigned char data){
while ( !( UCSR0A & (1<<UDRE0)) );
UDR0 = data;
}
void print_ln(const char* str)
{
int length = strlen(str);
int i;
for (i = 0; i < length; i++) {
transmit(str[i]);
}
}
I use this method with sprintf function
char str[32];
void loop(){
float data = 5;
sprintf(str, "%f", data);
print_ln(str);
}