This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BMP180_Sensor | |
{ | |
// Squirrel Class for Bosch BMP180 Temperature and Pressure Sensor | |
// [http://www.adafruit.com/datasheets/BST-BMP180-DS000-09.pdf] | |
// As used on the Adafruit BMP180 breakout board | |
// [http://www.adafruit.com/products/1603] | |
// Bus: I2C | |
// Code by Tony Smith (@smittytone) June 2014 | |
// Version 1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Constants for the alphanumeric character set | |
static charset = [ | |
[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00], // Space - Ascii 32 | |
[0x00,0x10,0x10,0x10,0x10,0x00,0x10,0x00], // ! | |
[0x00,0x24,0x24,0x00,0x00,0x00,0x00,0x00], // ” | |
[0x00,0x24,0x7E,0x24,0x24,0x7E,0x24,0x00], // # | |
[0x00,0x08,0x3E,0x28,0x3E,0x0A,0x3E,0x08], // $ | |
[0x00,0x62,0x64,0x08,0x10,0x26,0x46,0x00], // % | |
[0x00,0x10,0x28,0x10,0x2A,0x44,0x3A,0x00], // & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Squirrel Class for accessing 1-Wire devices, eg. | |
// Maxim Integrated DS18B20 temperature sensor | |
// [http://www.maximintegrated.com/datasheet/index.mvp/id/2812] | |
// via two-wire UART. The imp does not support 1-Wire natively | |
// Bus: UART | |
// Code by Tony Smith (@smittytone) June 2014 | |
// Version 1.0 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SSD1306_OLED { | |
// Squirrel Class for Solomon SSD1306 OLED controller chip | |
// [http://www.adafruit.com/datasheets/SSD1306.pdf] | |
// As used on the Adafruit SSD1306 I2C breakout board | |
// [http://www.adafruit.com/products/931] | |
// Bus: I2C | |
// Code by Tony Smith (@smittytone) June 2014 | |
// Version 1.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HT16K33QUAD | |
{ | |
// Squirrel class for 0.54-inch four-digit, 14-segment LED displays driven by the HT16K33 controller | |
// For example: http://shop.pimoroni.com/products/quad-alphanumeric-display-0-54-digits-w-i2c-backpack | |
// and: http://www.adafruit.com/product/1912 | |
// Communicates with any imp I2C bus | |
// Written by Tony Smith (@smittytone) August/September 2014 | |
// Version 1.0 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import time | |
import sys | |
import os | |
import Adafruit_GPIO as GPIO | |
import Adafruit_GPIO.FT232H as FT232H | |
# This class code derivaes from Adafruit's tutorial | |
# at https://learn.adafruit.com/adafruit-ft232h-breakout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum MAX7219_REGISTER { | |
BCD = 0x09, | |
BRIGHT = 0x0A, | |
SCAN = 0x0B, | |
PWR_MODE = 0x0C, | |
TEST_MODE = 0x0F | |
} | |
enum MAX7219_STATE { | |
HI = 1, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MCP9808 'constants' | |
const MCP9808_REG_CONFIG = 0x01; | |
const MCP9808_REG_UPPER_TEMP = 0x02; | |
const MCP9808_REG_LOWER_TEMP = 0x03; | |
const MCP9808_REG_CRIT_TEMP = 0x04; | |
const MCP9808_REG_TEMP = 0x05; | |
const MCP9808_REG_MANUF_ID = 0x06; | |
const MCP9808_REG_DEVICE_ID = 0x07; | |
const MCP9808_REG_RESOLUTION = 0x08; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const GROVE_TM1637_HIGH = 1; | |
const GROVE_TM1637_LOW = 0; | |
const GROVE_TM1637_ADDR_AUTO = 0x40; | |
const GROVE_TM1637_ADDR_FIXED = 0x44; | |
const GROVE_TM1637_DATA_CMD = 0xC0; | |
const GROVE_TM1637_DISPLAY_CMD = 0x88; | |
class GroveTM1637 { | |
// 'Private' properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LCD { | |
// A Squirrel class to drive a 16 x 2 to 20 x 4 character LCD driven by a Hitachi HD44780 controller | |
// via an MCP23008 interface chip on an Adafruit I2C backpack [http://www.adafruit.com/product/292] | |
// Communicates with any imp I2C bus | |
// Written by Tony Smith (@smittytone) October 2014 | |
// Version 1.1 | |
static MCP23008_IODIR = "\x00"; | |
static MCP23008_GPIO = "\x09"; |