All Projects → lepiaf → serialport

lepiaf / serialport

Licence: MIT License
PHP Serial Port

Programming Languages

PHP
23972 projects - #3 most used programming language
C++
36643 projects - #6 most used programming language

Projects that are alternatives of or similar to serialport

RxSerialPort
基于Rxjava2.x的串口通信library
Stars: ✭ 11 (-73.81%)
Mutual labels:  serial-ports, serialport
Node Serialport
Access serial ports with JavaScript. Linux, OSX and Windows. Welcome your robotic JavaScript overlords. Better yet, program them!
Stars: ✭ 5,015 (+11840.48%)
Mutual labels:  serial-ports, serialport
serialPort
Android通用的串口通信库
Stars: ✭ 39 (-7.14%)
Mutual labels:  serial-ports, serialport
Cserialport
基于C++的轻量级开源跨平台串口类库Lightweight cross-platform serial port library based on C++
Stars: ✭ 296 (+604.76%)
Mutual labels:  serial-ports, serialport
Rubyserial
FFI Ruby library for RS-232 serial port communication
Stars: ✭ 142 (+238.1%)
Mutual labels:  serial-ports, serialport
etherport-client
Client-side virtual serial port for Etherport. Used to implement firmata-compatible boards and relays.
Stars: ✭ 20 (-52.38%)
Mutual labels:  serial-ports, serialport
Androidserialport
Android串口通信示例
Stars: ✭ 497 (+1083.33%)
Mutual labels:  serial-ports, serialport
Ninjaterm
A serial port terminal that's got your back.
Stars: ✭ 24 (-42.86%)
Mutual labels:  serial-ports, serialport
Androidserialport
Android Serial Port , 基本的Android 串口通信库
Stars: ✭ 99 (+135.71%)
Mutual labels:  serial-ports, serialport
Cserialport
The latest modified version of Remon Spekreijse's serial port class
Stars: ✭ 64 (+52.38%)
Mutual labels:  serial-ports, serialport
Common
Yet another serial port debugger.
Stars: ✭ 245 (+483.33%)
Mutual labels:  serial-ports, serialport
Libserial
Serial Port Programming in C++
Stars: ✭ 201 (+378.57%)
Mutual labels:  serial-ports, serialport
serial.nim
A Nim library for accessing serial ports.
Stars: ✭ 59 (+40.48%)
Mutual labels:  serial-ports, serialport
libcssl
Columbo Simple Serial Library is an easy to use, event driven serial port communication library for Linux.
Stars: ✭ 38 (-9.52%)
Mutual labels:  serialport
JavaSerial
Use serial ports from Java using standard IO methods.
Stars: ✭ 14 (-66.67%)
Mutual labels:  serial-ports
pros-cli
Command Line Interface for managing PROS projects. Works with V5 and the Cortex
Stars: ✭ 92 (+119.05%)
Mutual labels:  serial-ports
ConsolePi
Raspberry Pi Based Serial Console Server, with PushBullet Notification of IP changes, Automatic VPN termination, custom menu, Power Outlet Control, and a lot more
Stars: ✭ 109 (+159.52%)
Mutual labels:  serial-ports
open-serial-port-monitor
Open source application to monitor traffic over a serial port
Stars: ✭ 100 (+138.1%)
Mutual labels:  serial-ports
SerialProtocol
A protocol for sending data between two Arduino devices, or between an Arduino and another device through a serial port
Stars: ✭ 36 (-14.29%)
Mutual labels:  serial-ports
SerialPundit
Serial port communication in Java - FTDI D2XX, HID API, X/Y modem
Stars: ✭ 116 (+176.19%)
Mutual labels:  serialport

SerialPort

Connect to serial port with PHP

Inspired by PHP-Serial, I simplify it and include composer.json to install via composer.

Actually, it works on linux. This library is suitable for working with Arduino.

Install via composer

composer require "lepiaf/serialport"

How to use

You can check a full example in example folder. It contains a basic Arduino sketch and php file to read it.

Instantiate a new SerialPort object with a parser and configure tty.

<?php

use lepiaf\SerialPort\SerialPort;
use lepiaf\SerialPort\Parser\SeparatorParser;
use lepiaf\SerialPort\Configure\TTYConfigure;

$serialPort = new SerialPort(new SeparatorParser(), new TTYConfigure());

$serialPort->open("/dev/ttyACM0");
while ($data = $serialPort->read()) {
    echo $data."\n";

    if ($data === "OK") {
        $serialPort->write("1\n");
        $serialPort->close();
    }
}

For mac os, you must use TTYMacConfigure. It will use stty -f instead of stty -F.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].