You should specify somewhere that's is free pascal!
I added the function to change the name of the bluetooth device. I can't have all my bluetooth to be all "hc-05". This way it is easier to identify the device.
113d112 < mod_name: ansistring; 130,134d128 < WriteLine(comhandle, 'AT+NAME?'); < mod_name := AfterColon(GetLine(comhandle)); < sleep(50); < tcflush(comhandle, TCIFLUSH); < 171d164 < writeln('Device name : ' + mod_name); 418,448d410 < Set name < -------------------------------------------------------------------------- } < procedure CommandSetName(comhandle: thandle); < const < COMMAND_ERROR = 'Error: Module did not accept command'; < CONFIG_ERROR = 'Error: Module could not be configured correctly'; < ERRORMSG = 'Error: Unexpected response: '; < AT_OK = 'OK'; < begin < writeln('Set name to '+ paramstr(3)); < WriteLine(comhandle, 'AT+NAME=' + paramstr(3)); < {if GetLine(comhandle) <> AT_OK then begin < writeln(COMMAND_ERROR); < halt; < end;} < GetLine(comhandle); < < writeln('Confirming the configuration...'); < < WriteLine(comhandle, 'AT+NAME?'); < if AfterColon(GetLine(comhandle)) <> paramstr(3) then begin < writeln(CONFIG_ERROR); < halt; < end; < sleep(50); < tcflush(comhandle, TCIFLUSH); < < writeln('Complete.'); < end; < < { -------------------------------------------------------------------------- 669,670d630 < end else if cmd = 'setname' then begin < CommandSetName(comhandle);
Cool All done in free pascal!
You should specify somewhere that's is free pascal!
I added the function to change the name of the bluetooth device. I can't have all my bluetooth to be all "hc-05". This way it is easier to identify the device.
113d112 < mod_name: ansistring; 130,134d128 < WriteLine(comhandle, 'AT+NAME?'); < mod_name := AfterColon(GetLine(comhandle)); < sleep(50); < tcflush(comhandle, TCIFLUSH); < 171d164 < writeln('Device name : ' + mod_name); 418,448d410 < Set name < -------------------------------------------------------------------------- } < procedure CommandSetName(comhandle: thandle); < const < COMMAND_ERROR = 'Error: Module did not accept command'; < CONFIG_ERROR = 'Error: Module could not be configured correctly'; < ERRORMSG = 'Error: Unexpected response: '; < AT_OK = 'OK'; < begin < writeln('Set name to '+ paramstr(3)); < WriteLine(comhandle, 'AT+NAME=' + paramstr(3)); < {if GetLine(comhandle) <> AT_OK then begin < writeln(COMMAND_ERROR); < halt; < end;} < GetLine(comhandle); < < writeln('Confirming the configuration...'); < < WriteLine(comhandle, 'AT+NAME?'); < if AfterColon(GetLine(comhandle)) <> paramstr(3) then begin < writeln(CONFIG_ERROR); < halt; < end; < sleep(50); < tcflush(comhandle, TCIFLUSH); < < writeln('Complete.'); < end; < < { -------------------------------------------------------------------------- 669,670d630 < end else if cmd = 'setname' then begin < CommandSetName(comhandle);