Skip to content

Instantly share code, notes, and snippets.

import time
import board
import busio
import usb_midi
import adafruit_midi
from adafruit_midi.note_on import NoteOn
from adafruit_midi.note_off import NoteOff
import random
USB_MIDI_channel = 1 # pick your USB MIDI out channel here, 1-16
# Write your code here :-)
import board
import digitalio
import gamepad
import time
import usb_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode
kbd = Keyboard(usb_hid.devices)
# Write your code here :-)
import time
import board
import busio
import usb_hid
from adafruit_bus_device.i2c_device import I2CDevice
import adafruit_dotstar
from adafruit_hid.keyboard import Keyboard
import time
import board
import neopixel
try:
import urandom as random
except ImportError:
import random
# Drive NeoPixels on the NeoPixels Block on Crickit for
# Circuit Playground Express
import time
import neopixel
import board
from adafruit_circuitplayground.express import cpx
from math import floor
num_pixels = 45 # Number of pixels driven from Crickit NeoPixel terminal
@benevpi
benevpi / soilmoisture.ino
Created August 27, 2020 13:41
A sketch for reading soil moisture levels and using Deep Sleep to preserve battery life on DIY More ESP32 soil boards
#include "DHT.h"
#include "esp_wifi.h"
#include <WiFi.h>
#include <ArduinoJson.h>
#include <HTTPClient.h>
//move to secrets
const char * networkName = "XXX";
const char * networkPswd = "XXX";
String AIOKey = "XXX";
@benevpi
benevpi / pedometer.ino
Created July 10, 2020 12:32
A more-working smart watch pedometer
#include "config.h"
// ToDO
// There's a power bug that stops the screen going to sleep if the USB's been unpowered
// This also doesn't update the steps if the screen's been off UNLESS there's one more step (interrrupt)
// Get weather from wifi IF it's being charged
// Make it last a day comfortably of full use
// Save steps per day between power downs
// upload steps somewhere? Google Sheets?
// no need to do processing (such as time updates) if the screen is off.
@benevpi
benevpi / stepcounter.ino
Created July 7, 2020 09:45
A simple step counter watch for lilygo2020 v1. Note - also needs a config.h
#include "config.h"
// ToDO
// There's a power bug that stops the screen going to sleep if the USB's been unpowered
// This also doesn't update the steps if the screen's been off UNLESS there's one more step (interrrupt)
// Get weather from wifi IF it's being charged
// Make it last a day comfortably of full use
// Save steps per day between power downs
// upload steps somewhere? Google Sheets?
@benevpi
benevpi / main.py
Created May 21, 2020 13:07
a micropython for turning an io pin on or off based on an Adafruit IO feed
import network
import time
from umqtt.robust import MQTTClient
import os
import sys
from machine import Pin
ADAFRUIT_IO_URL = b'io.adafruit.com'
ADAFRUIT_USERNAME = b'<insert username here>'
ADAFRUIT_IO_KEY = b'<insert Adafruit IO key here>'
@benevpi
benevpi / code.py
Created April 22, 2020 15:51
enviroplus featherwing gauge example
import time
import board
from pimoroni_envirowing import gas
from pimoroni_envirowing import screen
from gauge import Gauge
import displayio
import terminalio
import busio