Skip to content

Instantly share code, notes, and snippets.

View TonsOfFun's full-sized avatar
🏠
Working from home

Justin Bowen TonsOfFun

🏠
Working from home
View GitHub Profile
import os
import time
def run_pump(id=1, duration=0):
relay_on(id)
time.sleep(duration)
relay_off(id)
def relay_on(id=1):
os.system('usbrelay 5291D_'+str(id)+'=1')
import serial
from serial.tools import list_ports
ser = serial.Serial(list_ports.comports()[1].device, 9600)
while True:
print(ser.readline())
//**THIS CODE WILL WORK ON ANY ARDUINO**
//This code was written to be easy to understand.
//Modify this code as you see fit.
//This code will output data to the Arduino serial monitor.
//Type commands into the Arduino serial monitor to control the pH circuit.
//An Arduino UNO was used to test this code.
//This code was written in the Arduino 1.8.5 IDE
//This code was last tested 1/2018
#include <Wire.h>
#include <Adafruit_AM2315.h>
/***************************************************
This is an example for the AM2315 Humidity + Temp sensor
Designed specifically to work with the Adafruit BMP085 Breakout
----> https://www.adafruit.com/products/1293
These displays use I2C to communicate, 2 pins are required to
#include <Wire.h>
#include <Adafruit_AM2315.h>
/***************************************************
This is an example for the AM2315 Humidity + Temp sensor
Designed specifically to work with the Adafruit BMP085 Breakout
----> https://www.adafruit.com/products/1293
These displays use I2C to communicate, 2 pins are required to
interface
Adafruit invests time and resources providing this open source code,
@TonsOfFun
TonsOfFun / leaf_area.py
Created January 16, 2019 06:34
GreenThumb CV Leaf Area Filter
import numpy as np
import imutils
import cv2
import matplotlib.pyplot as plt
%matplotlib inline
# Defined bounds using https://github.com/jrosebr1/imutils/blob/master/bin/range-detector
leaf_lower = (29, 0, 0)
leaf_upper = (255, 255, 128)
@TonsOfFun
TonsOfFun / AM2315_air.ino
Last active March 6, 2019 03:01
Using this for Arduino sensor readings
#include <Wire.h>
#include <Adafruit_AM2315.h>
/***************************************************
This is an example for the AM2315 Humidity + Temp sensor
Designed specifically to work with the Adafruit BMP085 Breakout
----> https://www.adafruit.com/products/1293
These displays use I2C to communicate, 2 pins are required to
@TonsOfFun
TonsOfFun / capture.py
Created January 14, 2019 00:13
Camera Capture
# USAGE
# python save_key_events.py --output output
# import the necessary packages
from greenthumb.note import Note
from uuid import getnode as get_mac
from io import BytesIO
from picamera import PiCamera
import datetime
import imutils
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.