/**
 * @brief Setup
 *
 *	Setup Bluetooth module
 */
void bt_setut(void)
{
	/* Terminate the current Bluetooth connection. */
	bt_reset();

	/* Transparent connection settings */
	bt_send_cmd("\rAT"); // make sure the module is not in sleep mode
	bt_send_cmd("ATE0"); // disable echo
	bt_send_cmd("ATQ1"); // disable result code
	bt_send_cmd("ATC1"); // enable flow control: without this, avrdude under Windows will hang
	bt_send_cmd("ATR1"); // device is slave  
	bt_send_cmd("ATN=Bluecontroller"); // set new name
	bt_send_cmd("ATP=1234"); // set PIN
	bt_send_cmd("ATD0"); // accept connections from any bt device
	bt_send_cmd("ATX0"); // disable escape character (default)
	//bt_send_cmd("ATS1"); // enable power down of rs-232 driver (default)
	bt_send_cmd("ATO"); // reconnect to peer

	/* Allow module to save setting in flash */
	_delay_ms(1000);
	/* Activate new settings */
	bt_reset();
	
	bt_debug("reset");
}
示例#2
0
void ecrobot_device_terminate()
{
    reset_motor_power();
    //reset_data_structs();
    bt_reset();
    ecrobot_term_bt_connection();
}
示例#3
0
void Bluetooth::select_at_mode(bool at_mode=1)
{
    digitalWrite(key, (1 == at_mode)?HIGH:LOW);
    bt_reset();
    Serial.begin(38400);
}