Skip to content

Open Pixel Control (OPC) server for ESP on Arduino

License

Notifications You must be signed in to change notification settings

ideafablabs/IFLOpcServer

 
 

Repository files navigation

OpcServer

Open Pixel Control (OPC) server for ESP on the Arduino platform.

Compatible with boards that utilize Arduino style WiFiServer / WiFiClient APIs.

If you've run this successfully on other boards let us know!

Installation

git clone https://github.com/ideafablabs/IFLOpcServer.git

Usage

See examples.

Includes

#include "OpcServer.h"

Depending on your platform you may need to add other headers. For example ESP8266WiFi.h for ESP8266.

Initialize

Initialize OpcServer with WiFiServer, OpcClient sized for the number of clients you'd like to support, and a buffer large enough for the OPC messages you'd like to receive.

WiFiServer server = WiFiServer(OPC_PORT);
OpcClient opcClients[OPC_MAX_CLIENTS];
uint8_t buffer[OPC_BUFFER_SIZE * OPC_MAX_CLIENTS];

OpcServer opcServer = OpcServer(server, OPC_CHANNEL,
  opcClients, OPC_MAX_CLIENTS,
  buffer, OPC_BUFFER_SIZE);

setup()

Optionally add any callback functions you'd like OpcServer to run when a message is received or a client connects/disconnects.

opcServer.setMsgReceivedCallback(cbOpcMessage);
opcServer.setClientConnectedCallback(cbOpcClientConnected);
opcServer.setClientDisconnectedCallback(cbOpcClientDisconnected);

Then call .begin().

opcServer.begin();

loop()

Call .process() in your loop to process any incoming OPC data.

opcServer.process();

About

Open Pixel Control (OPC) server for ESP on Arduino

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 59.8%
  • C 37.7%
  • Makefile 2.5%