Skip to content

Custom serial port settings #163

Closed Answered by aldas
LaQuiete1988 asked this question in Q&A
Discussion options

You must be logged in to vote

just edit it in https://github.com/aldas/modbus-tcp-client/blob/master/examples/rtu_usb_to_serial.php

or if you are using https://github.com/aldas/modbus-tcp-client/blob/master/examples/rtu_usb_to_serial_stream.php

then pass it from constructor and you can change defaults

if (array_key_exists('sttyModes', $options)) {

like that

$connection = BinaryStreamConnection::getBuilder()
    ->setUri('/dev/ttyUSB0')
    ->setCreateStreamCallback(function (BinaryStreamConnection $conn) {
        $streamCreator = new SerialStreamCreator(['sttyModes' => SerialStreamCreator::DEFAULT_STTY_MODES]);
        return $s…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@LaQuiete1988
Comment options

Answer selected by LaQuiete1988
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants