Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
import paho.mqtt.client as mqtt
import RPi.GPIO as GPIO
def on_connect(client, userdata, rc):
#print ("Connected with rc: " + str(rc))
client.subscribe("kwf/demo/led")
def on_message(client, userdata, msg):
@DannyGH
DannyGH / ADXL325 accelero
Created October 26, 2015 09:08 — forked from xrl/ADXL325 accelero
ADXL345 accelerometer programming code. Immediately raises interrupt when inactivity below THRESH_INACT is detected.
//Add the SPI library so we can communicate with the ADXL345 sensor
#include <SPI.h>
//Assign the Chip Select signal to pin 10.
int CS=10;
//ADXL345 Register Addresses
#define DEVID 0x00 //Device ID Register
#define THRESH_TAP 0x1D //Tap Threshold
#define OFSX 0x1E //X-axis offset