Quantcast
Channel: Microcontrollers
Viewing all articles
Browse latest Browse all 4923

atmega8 + HC-05

$
0
0
hello everyone..
i was trying to interface HC-05 bluetooth module with atmega8. F_CPU=1MHz and baud rate for communication is 9600. i have a led at PORTB pin 0 and i will use any bluetooth app from play store to turn the led on or off.

usart.h
Code (Text):
  1. void usart_init(uint16_t ubrr_value)
  2. {
  3. UBRRL = ubrr_value;
  4. UBRRH = (ubrr_value>>8);
  5. UCSRB|= (1<<RXEN)|(1<<TXEN);
  6. UCSRC |= (1 << URSEL)|(3<<UCSZ0);
  7. }
  8.  
  9.  
  10. unsigned char usart_data_receive( void )
  11. {
  12. while ( !(UCSRA & (1<<RXC)) )
  13. ;
  14. return UDR;
  15. }
...

atmega8 + HC-05

Viewing all articles
Browse latest Browse all 4923

Trending Articles