Hello all Masters of B4A
How to send the word 16 bits (hex: FFFF) from Android to AVR?
I use this:
B4A
HC-05
AVR ATmega328P (no Arduino, no raspberry)
Code B4A info:
in BTmanager:
For Example:
When I want to send A0F5 (bin: 1010000011110101)
in AVR (UDR0) I have only ASCII code representation: 49
This is a representation only of the last bit of the whole:
1010 0000 1111 0101.
A, 0, F ang 3bits (010) of 5 are lost.
Do any of you know why this is happening?
Code AVR info:
How to send the word 16 bits (hex: FFFF) from Android to AVR?
I use this:
B4A
HC-05
AVR ATmega328P (no Arduino, no raspberry)
Code B4A info:
in BTmanager:
B4X:
Sub Class_Globals
Private AStream As AsyncStreams
End Sub
-----
Public Sub SendMessage (msg As String)
AStream.Write(msg.GetBytes("utf8"))
End Sub
When I want to send A0F5 (bin: 1010000011110101)
in AVR (UDR0) I have only ASCII code representation: 49
This is a representation only of the last bit of the whole:
1010 0000 1111 0101.
A, 0, F ang 3bits (010) of 5 are lost.
Do any of you know why this is happening?
Code AVR info:
B4X:
static uint8_t ReadByte(void)
{
while ( !( UCSR0A & (1<<RXC0) ) ); // waiting loop for data in the register UDR0
return UDR0;
}
Last edited: