Skip to content

Instantly share code, notes, and snippets.

@kenci
kenci / rx433_rpi.ino
Last active November 22, 2015 18:42
TinyRX433_RPI
// RFM12B Receiver for RaspberryPI
//
// Basiert zum Teil auf der Arbeit von Nathan Chantrell
//
// modified by meigrafd @ 16.12.2013 - for UART on RaspberryPI
//------------------------------------------------------------------------------
#include <RFM12B.h>
#include <avr/sleep.h>
#include <SoftwareSerial.h>
//------------------------------------------------------------------------------
@kenci
kenci / ambilight.ino
Created November 22, 2015 18:44
Ambilight for Arduino
#include "FastLED.h"
// How many leds in your strip?
#define NUM_LEDS 248
// For led chips like Neopixels, which have a data line, ground, and power, you just
// need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock,
// ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN
#define DATA_PIN 5
//#define CLOCK_PIN 13
@kenci
kenci / i2c-arduino.ino
Created November 22, 2015 18:51
Sending float array through I2C from Arduino to RPi
#include <Wire.h>
#define SLAVE_ADDRESS 0x04
#define FLOATS_SENT 3
float data[FLOATS_SENT];
void setup() {
pinMode(13, OUTPUT);
Serial.begin(9600); // start serial for output
@kenci
kenci / ftoa.ino
Last active November 22, 2015 19:03
Pulse decoder for S0 Interface
//
// Produce a formatted string in a buffer corresponding to the value provided.
// If the 'width' parameter is non-zero, the value will be padded with leading
// zeroes to achieve the specified width. The number of characters added to
// the buffer (not including the null termination) is returned.
//
unsigned
fmtUnsigned(unsigned long val, char *buf, unsigned bufLen, byte width)
{
@kenci
kenci / alarmsystem.ino
Last active January 23, 2023 13:38
ESP8266 NTP Timeserver with Alarms
/*
* alarmsystem.ino
*
* This sketch uses the ESP8266WiFi library
*/
#include <TimeLib.h>
#include <Time.h>
#include <TimeAlarms.h>
#include <ESP8266WiFi.h>
@kenci
kenci / socket-pimatic.js
Created February 1, 2016 12:35
Pimatic socket
var io = require('/usr/local/lib/node_modules/socket.io/node_modules/socket.io-client');
var mqtt = require('/usr/local/lib/node_modules/mqtt');
var mqttClient = mqtt.connect('mqtt://mqtt.server.ip', {
username: 'user',
password: 'password',
rejectUnauthorized: false
});
var host = 'pimatichost';
var port = 1607; //pimatic port
var u = encodeURIComponent('user'); //pimatic username
@kenci
kenci / mosquitto
Created February 19, 2016 21:48
Mosquitto Init.d
#! /bin/sh
### BEGIN INIT INFO
# Provides: mosquitto
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: mosquitto MQTT v3.1 message broker
# Description:
@kenci
kenci / nodered
Created February 19, 2016 22:27
Nodered init.d
#! /bin/sh
# Starts and stops Node-RED
# /etc/init.d/nodered
### BEGIN INIT INFO
# Provides: node-red
# Required-Start: $syslog
# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Node-RED initialisation
/*
PROJECT: MySensors / LiON charger board
PROGRAMMER: AWI
DATE: 28 april 2015/ last update: 11 may 2015 / BH1750 added: 5 September 2015
FILE: MS_Solar_2.ino
LICENSE: Public domain
Hardware: Ceech - ATmega328p board w/ ESP8266 and NRF24l01+ socket LTC4067 lithium battery charger
and MySensors 1.4
@kenci
kenci / update-redis.txt
Created March 21, 2016 10:00
Update redis
git clone --branch 2.2.7 https://github.com/phpredis/phpredis​
cd phpredis
​cat php_redis.h | grep VERSION
phpize
./configure
sudo make
sudo make install