i don't understand why my avr does not receive anything although my code runs on proteus good , i send characters from mobile app to hc-05 and then check these characters and do action base on them but avr doesn't respond at all , here is the code
#define F_CPU 16000000
#include <avr/io.h>
#include <util/delay.h>
void forward()
{
PORTA=0b00000101;
}
void backward()
{
PORTA=0b00001010;
}
void right()
{
PORTA=0b00001001;
}
void left()
{
PORTA=0b00000110;
}
void stop()
{
PORTA=0;
}
int main(void)
{
DDRA = 0b00001111;
uint16_t UBRRValue = 103;
UBRRL = (uint8_t)UBRRValue;
UBRRH = (uint8_t)(UBRRValue>>8);
UCSRB = (1<<RXEN)|(1<<TXEN);
UCSRC|= (3<<UCSZ0);
while (1)
{
while(!(UCSRA&(1<<RXC)));
switch(UDR)
{
case 'W':forward(); break;
case 'S': backward(); break;
case 'D':right(); break;
case'A': left(); break;
default : stop(); break;
}
}
return 0;
}
should i do something to hc-05 or add some code?
* Posted in the wrong forum. *