Skip to content

Instantly share code, notes, and snippets.

View ShawnHymel's full-sized avatar

Shawn Hymel ShawnHymel

View GitHub Profile
@ShawnHymel
ShawnHymel / micro_bit_01_my_name.py
Created August 9, 2016 03:36
micro:bit Tutorial Series Part 1: Getting Started - My Name
from microbit import *
while True:
display.scroll("Shawn")
@ShawnHymel
ShawnHymel / micro_bit_01_hello.py
Created August 11, 2016 00:43
Make the micro:bit scroll the phrase "Hello!"
from microbit import *
while True:
display.scroll("Hello!")
@ShawnHymel
ShawnHymel / pwm_mux.ino
Created August 16, 2016 16:44
Control 8 LEDs using a multiplexer
/**
* 8-Channel Multiplexer Demo
* August 16, 2016
* License: Public Domain
*
* Show PWM on 8 LEDs using 4 I/O pins and an analog input to
* adjust the PWM period.
*
* Hardware:
* Mux | Trimpot | Arduino
@ShawnHymel
ShawnHymel / micro_bit_02_faces.py
Created August 23, 2016 03:45
Have the micro:bit show a happy face when A is pressed, a sad face when B is pressed, and a meh face when no buttons are pressed.
from microbit import *
while True:
if button_a.is_pressed():
display.show(Image.HAPPY)
elif button_b.is_pressed():
display.show(Image.SAD)
else:
display.show(Image.MEH)
@ShawnHymel
ShawnHymel / micro_bit_02_more_faces.py
Created August 23, 2016 03:50
Just like the example code, but it shows a confused face when the buttons are pressed simultaneously
from microbit import *
while True:
if button_a.is_pressed():
if button_b.is_pressed():
display.show(Image.CONFUSED)
else:
display.show(Image.HAPPY)
elif button_b.is_pressed():
display.show(Image.SAD)
@ShawnHymel
ShawnHymel / micro_bit_02_A_and_B.py
Created August 23, 2016 03:53
Shows a happy face by default but scrolls "A" when A is pressed and "B" when B is pressed
from microbit import *
while True:
if button_a.is_pressed():
display.scroll("A")
elif button_b.is_pressed():
display.scroll("B")
else:
display.show(Image.HAPPY)
@ShawnHymel
ShawnHymel / Prop_Shield_Demo.ino
Created August 31, 2016 18:54
Change light color/brightness and sound frequency/volume based on the roll and pitch of the device.
/**
* Prop Shield Demo
* Author: Shawn Hymel
* Date: August 31, 2016
*
* Description:
* Connect a single WS2812B to the LED output on the Prop Shield
* and a >2W speaker to the +/- speaker output. Attach the shield
* to a Teensy 3.2 and run the NXPMotionSense calibration sketch
@ShawnHymel
ShawnHymel / edibot_2.0_test_01.py
Created September 8, 2016 23:04
EdiBot 2.0 Python Test
import cv2
# Debugging options
SHOW_IMAGE = True
VERBOSE = True
# HSV color thresholds for YELLOW
THRESHOLD_LOW = (15, 215, 50);
THRESHOLD_HIGH = (35, 255, 255);
@ShawnHymel
ShawnHymel / edison_h-bridge_test.py
Created September 9, 2016 17:25
Test of the H-Bridge Block with the Intel Edison
import mraa
import time
# Motor parameters. Set to 1 or -1 to change default direction
dirA = 1
dirB = 1
# PWM A (pin 12) is on pin 20 in MRAA
pwmA = mraa.Pwm(20)
pwmA.period_us(1000)
@ShawnHymel
ShawnHymel / usno_get.ino
Created September 15, 2016 16:01
USNO API Example
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
// WiFi information
const char WIFI_SSID[] = "AP SSID";
const char WIFI_PSK[] = "AP PASSWORD";
// Remote site information
const char http_site[] = "api.usno.navy.mil";
const int http_port = 80;