//============================================================================= // Sub functions static void connect_bt(Lcd &lcd, char bt_name[16]) { //CHAR name[16] = "Kachi"; U8 address[7]; lcd.clear(); if (mBluetooth.getDeviceAddress(address)) // get the device address { lcd.putf("sn", "BD_ADDR:"); for (SINT i=0; i<7; i++) lcd.putf("x", address[i],2); mBluetooth.setFriendlyName(bt_name); // set the friendly device name if (mBluetooth.getFriendlyName(bt_name)) // display the friendly device name { lcd.putf("nssn", "BD_NAME: ", bt_name); } lcd.putf("nsn", "Connecting BT..."); lcd.putf("sn", "ENTR to cancel."); lcd.disp(); if (mBluetooth.waitForConnection("1234", 0)) // wait forever { lcd.putf("s", "Connected."); } } else { lcd.putf("s", "BT Failed."); } lcd.putf("ns", "Press Touch."); lcd.disp(); }