na bluettoth modulu sam promijenio ime
AT+NAME=GRUNF_BT
i brzinu na uart-u
AT+UART=9600,0,0
a code za pic je u mikroC pro i vrlo je jednostavan, cekaj podatke kada dodju radi nesto i to je to
:
i jos jednom da napomenem da sam probao i sa samsungovim android telefonima na kojima je dignut froyo, nisam supio ni vidjeti bluetooth modul a kamo li se konektovati, s gingerbreadom ide sve "automatski"
@VooDooX
ja platio modul 16.11 na dealextrem-u jos ga nisu poslali, pise waiting for supplier
Code: Select all
// LCD conn
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;
sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
// LCD conn
char uart_rd;
void main() {
ANSEL = 0; // AN pinovi kao digital
ANSELH = 0;
trisd=0;
portd=0;
UART1_Init(9600); // Initi UART 9600 bps
Delay_ms(100);
Lcd_Init(); // Init LCD
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
lcd_out(1,1,"Recived data!");
while (1) { // loop
if (UART1_Data_Ready()) { // If data is received,
uart_rd = UART1_Read(); // read the received data,
if(uart_rd=='1') // if "1" then
{
if (portd.f0==0)
{
portd.f0=1;LCD_Chr(1,15,uart_rd);
}
else if(portd.f0==1)
{
portd.f0=0;LCD_Chr(1,15,uart_rd);
}
}
if(uart_rd=='0') // if"0" then
{
if (portd.f1==0)
{
portd.f1=1;LCD_Chr(1,15,uart_rd);
}
else if(portd.f1==1)
{
portd.f1=0;LCD_Chr(1,15,uart_rd);
}
}
}
}
}