Skip to content

Instantly share code, notes, and snippets.

View raspberrycoulis's full-sized avatar

Wesley Archer raspberrycoulis

View GitHub Profile

Hello World!

@raspberrycoulis
raspberrycoulis / BME280-ESP32-DeepSleep.cpp
Created February 17, 2021 14:22 — forked from Schm1tz1/BME280-ESP32-DeepSleep.cpp
Low-Power-Arduino Sketch for a simple weather station using ESP32 with DeepSleep and BME280 that can be powered by a small battery.The ESP is waking up every SLEEP_IN_US microseconds, reading the sensor and going to sleep again.
//
// ESP32 in DeepSleep reading a BME280 every few seconds
//
#include <Arduino.h>
#include <Wire.h>
#include <HardwareSerial.h>
#include <Adafruit_BME280.h>
#define SERIAL_BAUD 9600
@raspberrycoulis
raspberrycoulis / twitter-follower-bot.py
Created March 9, 2017 11:18
Python script to check your Twitter followers and send you a Slack notification of how many this is.
#!/usr/bin/python
import tweepy
import urllib2
import time
# For Twitter: Add the relevant keys, tokens and secrets from your Twitter app made here: https://apps.twitter.com/
consumer_key = ''
consumer_secret = ''
@raspberrycoulis
raspberrycoulis / Pi-lluminate.md
Last active March 7, 2018 17:25
Using the Enviro pHAT to calculate the average lux in the room, and turn on some lights if it gets too dark

Pi-lluminate the room

This is an attempt at a Python script to make use of Pimoroni's Enviro pHAT to calculate the average light level (lux) in a room, and to trigger an action if the lux drops below a pre-determined threshold (in this case, send a webhook command to turn on some Philips Hue lights).

Enviro pHAT average lux calculation

I "borrowed" some of the code used in Pimoroni's BME680 Breakout Board to calculate the average lux level. The idea being that the Enviro pHAT captures the lux for 15 seconds, then calculates the average reading that is then used to trigger the action.

Webhooks

For simplicity, I'm using IFTTT's Maker channel to use webhooks. These webhooks link to an IFTTT applet that triggers a Philips Hue bulb at home based on the parameters passed.

@raspberrycoulis
raspberrycoulis / cpu.py
Last active July 7, 2017 10:49
Display CPU usage on Pimoroni's Scroll pHAT HD
#!/usr/bin/env python
import sys
import time
try:
import psutil
except ImportError:
sys.exit("This script requires the psutil module\nInstall with: sudo pip install psutil")
@raspberrycoulis
raspberrycoulis / mote_api.py
Created March 19, 2017 18:21
Mote pHAT API
from colorsys import hsv_to_rgb, rgb_to_hsv
import motephat
from flask import Flask, jsonify, make_response
app = Flask(__name__)
motephat.configure_channel(1, 16, False)
motephat.configure_channel(2, 16, False)
motephat.configure_channel(3, 16, False)
motephat.configure_channel(4, 16, False)
@raspberrycoulis
raspberrycoulis / blinkt-followers.py
Created March 15, 2017 18:35
Python script that checks Instagram and flashes Pimoroni's Blinkt if the follower count has increased
#!/usr/bin/python
import urllib2
from urllib import quote
import time
import json
from config import (
ig_style,
ig_account,
ig_access_token,
@raspberrycoulis
raspberrycoulis / twitter.py
Created March 10, 2017 18:21
Raspberry Pi Twitter Follower Bot Python script
#!/usr/bin/python
import tweepy
import urllib2
import time
# For Twitter: Add the relevant keys, tokens and secrets from your Twitter app made here: https://apps.twitter.com/
consumer_key = ''
consumer_secret = ''
@raspberrycoulis
raspberrycoulis / facebook.py
Created March 10, 2017 18:17
Raspberry Pi Facebook Fan Bot Python script
#!/usr/bin/python
import urllib2
from urllib import quote
import json
# Variables - configure the bits below to get your script working.
style = '#3b5998' # Colour for the message - default is Facebook blue
fb_page = '' # Facebook Page name