Skip to content

Instantly share code, notes, and snippets.

@sticilface
sticilface / modbus_MAX31865.ino
Last active July 19, 2019 09:01
Basic UNO sketch reading MAX31865 v2
//-----------------------------------------------------------------------------
// Copyright 2018 Thiago Alves
// This file is part of the OpenPLC Software Stack.
//
// OpenPLC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenPLC is distributed in the hope that it will be useful,
@sticilface
sticilface / spram_allocator.h
Created March 21, 2019 16:28
custom PSRAM STL allocator
template <typename T>
class spram_allocator
{
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef T* pointer;
typedef const T* const_pointer;
typedef T& reference;
typedef const T& const_reference;
@sticilface
sticilface / surrogate.ino
Created July 29, 2018 17:18
Working surrogate
/* This sketch lets a RemoteWorker device connected through Ethernet TCP act
as if it is present on the SoftwareBitBang bus connected to this Surrogate
device.
The RemoteWorker sketch can the run on a device not capable of SWBB but
with Ethernet support, like a PC or a Raspberry PI.
Surrogate and RemoteWorker examples contributed by Fred Larsen. */
#define PJON_PACKET_MAX_LENGTH 50
#define SERIAL_METHOD ThroughAsyncSerial // ThroughSerial or ThroughAsyncSerial
#define ROUTER_TYPE 2 // 1 = PJONVirtualBusRouter, 2 = segmented switch...
#define PJON_MAX_PACKETS 3
#define BUS_ID 253
#define PJON_BUS_PIN 2
#define PJON_INCLUDE_SWBB
#define PJON_INCLUDE_ANY
#define PJON_INCLUDE_TAS
#define USE_SERIAL
//#define USE_ACK
#define SERIAL_METHOD ThroughAsyncSerial // ThroughSerial or ThroughAsyncSerial
#define SERIAL_SPEED 115200
#define SWBB_PIN 2 // use 2 for arduino, 5 for ESP8266
#if defined (USE_SERIAL) && defined (ESP32)
#define SERIAL_PORT Serial2
@sticilface
sticilface / trans.ino
Last active July 29, 2018 17:13
Transmitter_speed_sketch
//#define USE_SERIAL
//#define USE_ACK
#define SERIAL_METHOD ThroughAsyncSerial // ThroughSerial or ThroughAsyncSerial
#define SERIAL_SPEED 115200
#define SWBB_PIN 2 // use 2 for arduino, 5 for ESP8266
#if defined (USE_SERIAL) && defined (ESP32)
#define SERIAL_PORT Serial2
#elif defined (USE_SERIAL)
#define SERIAL_METHOD ThroughSerial // ThroughSerial or ThroughAsyncSerial
#define PJON_MAX_PACKETS 3
#define PJON_BUS_PIN 2
#define PJON_INCLUDE_SWBB
#define PJON_INCLUDE_ANY
#define PJON_INCLUDE_TAS
#define PJON_INCLUDE_TS
@sticilface
sticilface / speedtests.md
Last active July 28, 2018 20:31
speed tests results PJON Serial

Speed Tests

ThroughSerial

Leonado to Leonado (115200 baud)

1 second communication speed test:
Packet Overhead: 10B - Total: 190B
Bandwidth: 570.00B/s

@sticilface
sticilface / test.h
Created June 23, 2017 07:14
Error when using PROGMEM strings and DEBUG with PSTR() in template functions
#ifndef TEST_H
#define TEST_H
#define TEST Serial
const char testString[] PROGMEM = "Test String";
#if defined(TEST)
[HTTP-Client][begin] url: http://192.168.1.42/esp/local/MySONOFF/debugsonoff/manifest.json
[HTTP-Client][begin] host: 192.168.1.42 port: 80 url: /esp/local/MySONOFF/debugsonoff/manifest.json
[hostByName] Host: 192.168.1.42 is a IP!
:ref 1
[HTTP-Client] connected to 192.168.1.42:80
:wr 183 183 0
:wrc 183 183 0
:sent 183
:rn 240
:rch 240, 946