2017 © Pedro Peláez
 

library serial

Serial device manipulation toolkit

image

daverandom/serial

Serial device manipulation toolkit

  • Thursday, May 31, 2018
  • by DaveRandom
  • Repository
  • 1 Watchers
  • 2 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Serial

<?php

use DaveRandom\Serial\DeviceManager;
use DaveRandom\Serial\ParityMode;
use DaveRandom\Serial\ControlFlowMode;

// Use COM1
const COM_PORT = 1;

// Create the correct device manager for the current platform (only windows supported so far)
$manager = DeviceManager::create();

// Get the current config for COM1
$config = $manager->getConfigForDevice(COM_PORT);
var_dump($config);

// Modify some parameters and set the config
$config
    ->setBaudRate(9600)
    ->setParityMode(ParityMode::NONE)
    ->setDataBits(8)
    ->setStopBits(1)
    ->setControlFlowMode(ControlFlowMode::NONE)
;
$manager->configureDevice(COM_PORT, $config);

// Open the device
$device = $manager->openDevice(COM_PORT);

// Send a message to the device
$device->write('D');

// Read some data from the device
var_dump($device->read());

The Versions

31/05 2018

dev-master

9999999-dev

Serial device manipulation toolkit

  Sources   Download

MIT

The Requires