Skip to content

Instantly share code, notes, and snippets.

View kevinmcaleer's full-sized avatar

Kevin McAleer kevinmcaleer

View GitHub Profile
@kevinmcaleer
kevinmcaleer / _config.yml
Created November 2, 2019 14:25
jeykll config.yml
gems:
- jekyll-octicons
collections:
pages:
output: true
permalink: /:path
sass:
style: :compressed
#include <SoftwareSerial.h>
// This is a short sketch to test bluetooth modules.
// Connect the bluetooth RX to Pin 2 on the Arduino and TX to Pin 3.
SoftwareSerial mySerial(2,3);
void setup() {
// put your setup code here, to run once:
mySerial.begin(9600);
Serial.begin(9600);
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET 4 // Reset pin # (or -1 if sharing Arduino reset pin)
@kevinmcaleer
kevinmcaleer / docker_registry.md
Last active December 17, 2021 13:46
Install a Docker Registry on your own local server

Install your Registry (on your server or locally)

Docker-Registry is a simple Python app, installing it is straight-forward:

git clone https://github.com/dotcloud/docker-registry.git
cd docker-registry
cp config_sample.yml config.yml
pip install -r requirements.txt
@kevinmcaleer
kevinmcaleer / threads.py
Created June 20, 2022 23:52
MicroPython v1.19 threads Demo
# threads demo
import _thread
from time import sleep
def hello():
for _ in range(10):
print("hello world")
sleep(0.5)
print('exiting')
@kevinmcaleer
kevinmcaleer / ping.py
Created March 24, 2023 13:59
SR-HC04 Ultrasonic Range Finder code in Python and MicroPython
from machine import Pin
from time import sleep_us, ticks_us
class Range_Finder():
duration = 0
distance = 0
def __init__(self, echo_pin, trigger_pin):
# Initialise the Range Finder
@kevinmcaleer
kevinmcaleer / Lego_self_balancing_robot.py
Created April 2, 2023 16:51
A Lego Self Balancing Robot
from pybricks.geometry import Axis
from pybricks.hubs import InventorHub
from pybricks.parameters import Direction, Port
from pybricks.pupdevices import ColorSensor, Motor
from pybricks.tools import StopWatch, wait
# Initialize motors.
left = Motor(Port.C, Direction.COUNTERCLOCKWISE)
right = Motor(Port.D)
left.reset_angle(0)
@kevinmcaleer
kevinmcaleer / picotamachibi.py
Created June 12, 2023 20:13
Picotamachibi version 1.0
# from icons import food_icon
from machine import I2C, Pin
from ssd1306 import SSD1306_I2C
from icon import Animate, Icon, Toolbar, Button, Event
from time import sleep
import framebuf
import gc
sda = Pin(0)
scl = Pin(1)
@kevinmcaleer
kevinmcaleer / remote.py
Last active February 12, 2024 21:17
Bluetooth Remote Control for Raspberry Pi Pico W
# Kevin McAleer
# 2023-06-28
# Bluetooth cores specification versio 5.4 (0x0D)
import sys
import aioble
import bluetooth
import machine
import uasyncio as asyncio
@kevinmcaleer
kevinmcaleer / emoji.py
Last active July 17, 2023 14:09
Happy Emoji Day!
# Did you know you can print Emojis in Python?
print("🥰 Happy 🌎 Emoji day! ❤️ 🐍🐍🐍")