This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Listen to all MQTT requests (port 1883) | |
listen mqtt | |
# MQTT binding to port 1883 | |
bind *:1883 | |
# communication mode (MQTT works on top of TCP) | |
mode tcp | |
option tcplog | |
# balance mode (to choose which MQTT server to use) | |
balance leastconn | |
# MQTT server 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Container to start from with a working HAProxy definition | |
FROM dockerfile/haproxy | |
MAINTAINER Andrea Reginato <andrea.reginato@gmail.com> | |
# Add personalized configuration | |
ADD haproxy.cfg /etc/haproxy/haproxy.cfg | |
# Add restart commands | |
ADD restart.bash /haproxy-restart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# node image | |
FROM node:0.10-onbuild | |
# docker mantainer | |
MAINTAINER reggie | |
# add the files to load | |
ADD ./ . | |
# install all needed packages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var server = require('./lib/server') | |
, debug = require('debug')('lelylan'); | |
var ascoltatore = { | |
type: 'redis', | |
redis: require('redis'), | |
db: 12, | |
port: 6379, | |
host: process.env.REDIS_HOST } | |
, settings = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MQTT server address | |
byte server[] = { 178, 62, 108, 47 }; | |
// Yun definition | |
YunClient yun; | |
// subscription callback | |
void callback(char* topic, byte* payload, unsigned int length); | |
// mqtt client connection | |
PubSubClient client(server, 1883, callback, yun); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* arduino setup */ | |
void setup() { | |
Serial.begin(9600); | |
delay(500); | |
Serial.println("Start initialization of Yun..."); | |
Bridge.begin(); | |
Serial.println("Starting connection to lelylan..."); | |
lelylanConnection(); // MQTT server connection | |
pinMode(inPin, INPUT); // button pin setup | |
pinMode(outPin, OUTPUT); // led pin setup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Pins configuration */ | |
int inPin = 3; // button | |
int outPin = 13; // led |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RPi.GPIO as GPIO | |
GPIO.setmode(GPIO.BOARD) | |
GPIO.cleanup() | |
# led pin setup | |
GPIO.setup(7, GPIO.OUT) | |
# button pin setup | |
GPIO.setup(12, GPIO.IN) | |
import mosquitto, json, time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Adafruit_CC3000.h> | |
#include <ccspi.h> | |
#include <SPI.h> | |
#include <cc3000_PubSubClient.h> | |
// These are the interrupt and control pins | |
#define ADAFRUIT_CC3000_IRQ 3 | |
// These can be any two pins | |
#define ADAFRUIT_CC3000_VBAT 9 | |
#define ADAFRUIT_CC3000_CS 10 |