Skip to content

Instantly share code, notes, and snippets.

View a-andreyev's full-sized avatar
🕊️

Alexey Andreyev a-andreyev

🕊️
View GitHub Profile
@a-andreyev
a-andreyev / mercury_201_esp8266_sketch.ino
Last active January 28, 2016 14:13
Mercury 201 SemIoT device prototype
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <EEPROM.h>
#define PULSE_PIN 2 // GPIO2
// debug led to VCC:
#define DEBUG_LED_PIN 0 // GPIO0
#define DEBUG_LED_LIGHT LOW
#define DEBUG_LED_DARK HIGH
@a-andreyev
a-andreyev / max485toMega.ino
Created January 20, 2016 09:05
pc <-- usb --> arduino mega 2560 <--> max485 to ttl module <-- rs485 --> energomera ce 102 AK
#define SerialTxControl 10
#define RS485Transmit HIGH
#define RS485Receive LOW
void setup() {
// initialize both serial ports:
Serial.begin(9600);
Serial3.begin(9600);
pinMode(SerialTxControl, OUTPUT);
digitalWrite(SerialTxControl, RS485Receive);
@a-andreyev
a-andreyev / energomera_ce102r5_ak.ino
Last active January 20, 2016 15:59
energomera ce102r5 ak via max485 initial support
// TODO: separate to lib:
#define DEBUG_BAUDRATE 115200
// RS485 PROTOCOL:
#define SerialTxControl 10
#define RS485Transmit HIGH
#define RS485Receive LOW
// CE PROTOCOL:
#define CE_BAUDRATE 9600
import QtQuick 2.2
import ru.semiot.gateway 0.1
SemIoTDeviceConfig {
// NOTE: is that ok that system driver is only one per device driver?
driverName: "udp";
onDriverConnected: {
addDriverDataSource({"port":33333})
}
onNewDataPacketReceived: {
@a-andreyev
a-andreyev / semiot.ru
Created February 29, 2016 14:59
udp_timer_actuator_minimal_example.qml
import QtQuick 2.2
import ru.semiot.gateway 0.1
SemIoTDeviceConfig {
driverName: "udp";
property int listenPort: 54321
onDriverConnected: {
// do nothing
// addDriverDataSource({"port":listenPort})
}
@a-andreyev
a-andreyev / PKGBUILD
Last active March 11, 2016 12:39
Breakfastquay Dataquay ArchLinux PKGBUILD
# Maintainer: aa13q <[email protected]>
# Contributor: speps <speps at aur dot archlinux dot org>
pkgname=dataquay-git
appname=dataquay
pkgver=0.9
pkgrel=3
pkgbranch=master
pkgdesc="A free open source library that provides a friendly C++ API for an RDF data store, using Qt classes and containers."
arch=(i686 x86_64)
from socketserver import *
host = '192.168.0.121'
port = 5683
addr = (host,port)
class MyUDPHandler(DatagramRequestHandler):
def handle(self):
data = self.request[0]
// TODO: separate to lib:
#define DEBUG_BAUDRATE 115200
// RS485 PROTOCOL:
#define SerialTxControl 10
#define RS485Transmit HIGH
#define RS485Receive LOW
// CE PROTOCOL:
#define CE_BAUDRATE 9600
@a-andreyev
a-andreyev / truthtable.py
Last active October 18, 2016 15:23 — forked from pindia/gist:3836713
Python truth table calculator
#!/usr/bin/python2
# based on: https://gist.github.com/pindia/3836713
from itertools import izip, product, tee
# Logic functions: take and return iterators of truth values
def AND(a, b):
for p, q in izip(a, b):
yield p and q
@a-andreyev
a-andreyev / PKGBUILD
Last active November 16, 2016 23:00
linux4tegra-ventana AUR archlinux PKGBUILD
# Based on linux-tegra by: Anatol Pomozov <[email protected]>
# Contributor: Alexey Andreyev <[email protected]>
pkgname=linux4tegra
pkgver=24
pkgrel=1
pkgdesc='linux4tegra'
arch=(x86_64)
license=(NVIDIA)
depends=(lib32-glibc lib32-gcc-libs) # mkbootimg is 32-bit binary