Skip to content

Instantly share code, notes, and snippets.

View brooksware2000's full-sized avatar

Curtis Brooks brooksware2000

View GitHub Profile
@brooksware2000
brooksware2000 / jingle_bells.cc
Created November 16, 2017 03:17 — forked from elubow/jingle_bells.cc
Using a Piezo Element and Arduino, you can play jingle bells using this code sample.
int speakerPin = 5;
int length = 26;
char notes[] = "eeeeeeegcde fffffeeeeddedg";
int beats[] = { 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2};
int tempo = 300;
void playTone(int tone, int duration) {
for (long i = 0; i < duration * 1000L; i += tone * 2) {
digitalWrite(speakerPin, HIGH);
delayMicroseconds(tone);
@brooksware2000
brooksware2000 / Serial_ISR.pbp
Created November 25, 2012 19:20
LCD serial interrupt initialization and ISR routine
;Enable unmasked peripheral interrupts
INTCON = %11000000
;Declear interrupt handler
ON INTERRUPT goto Serial_Interrupt
;Enable interrupt on USART (Serial Receive)
PIE1.5 = 1
...
@brooksware2000
brooksware2000 / LCD_2_1.pbp
Created November 25, 2012 19:07
Header file and defines for Serial LCD Controller
;-----[ Includes ]---------------------------------------------------------
INCLUDE "16F628A.pbp"
;-----[ Defines ]----------------------------------------------------------
;Define oscillator speed in Mhz
DEFINe OSC 20
;Define which port is connected to the LCD Data pins D4 - D7
DEFINE LCD_DREG PORTB
@brooksware2000
brooksware2000 / Serial_Sensor_Demo2.ino
Created September 6, 2012 21:58
Sends sensor data and relay status from the thermostat/temperature node over the serial port.
/*
Demonstration sketch for the Hobbybotics Wireless Thermostat/Temperature Node.
Sends sensor data and relay status over the serial port.
*/
#include <MCP23008.h> // MCP23008 I/O Expander (I2C)
#include <LCD.h> // I2C LCD
#include <Wire.h> // I2C functions
#include <OneWire.h> // One-wire devices
@brooksware2000
brooksware2000 / LCD_relay_Demo3.ino
Created September 6, 2012 00:27
Example menu and relay control sketch for the Wireless Thermostat/Temperature board
/*
Demonstration sketch for the Hobbybotics Wireless Thermostat/Temperature Node.
Creates a LCD menu system and allows ON/OFF control for the relays on the System
Output Controller board.
Sections of code that is not needed for this demonstration is commented out
*/
#include <MCP23008.h> // MCP23008 I/O Expander (I2C)
@brooksware2000
brooksware2000 / DS3234_LCD_demo2.ino
Created September 5, 2012 04:24
Example sketch for the DS3234 SPI Real Time Clock (RTC). Prints results to an I2C LCD.
/*
Demonstration sketch for Hobbybotics Wireless Thermostat/Temperature Node V2.0 using DS3234 RTC.
Reads Date and Time. Displays results to LCD
*/
#include <SPI.h>
#include <Wire.h>
#include <RTClib.h>
#include <DS3234.h>
@brooksware2000
brooksware2000 / LCD_TEMT6000_demo.ino
Created September 5, 2012 04:06
Test sketch for the TEMT6000 light sensor
/*
Demonstration sketch for TEMT6000 light sensor.
Reads light level (lux) and prints results to I2C LCD.
*/
#include <TEMT6000.h>
#include <LCD.h>
#include <Wire.h>
@brooksware2000
brooksware2000 / DS18B20_LCD_demo.ino
Created September 5, 2012 00:46
Example sketch for DS18B20 temperature sensors using the DallasTemperature library. Prints results to an I2C LCD.
/*
Demonstration sketch for DS18B20 temperature sensors using the DallasTemperature library.
Reads temperature (Celsius) and temperature (Fahrenheit). Displays results to I2C LCD.
*/
#include <LCD.h> // I2C LCD
#include <Wire.h> // I2C
#include <OneWire.h> // One-wire devices
#include <DallasTemperature.h> // DS18B20
@brooksware2000
brooksware2000 / SHT15_LCD.ino
Created September 5, 2012 00:14
Test sketch for the SHT15 humidity/temperature sensor
/*
Demonstration sketch for Hobbybotics SHT1x humidity/temperature sensor
breakout V1.o.
Reads humidity, temperature (Celsius) and temperature (Fahrenheit).
Displays results to LCD.
*/
#include <LCD.h>
#include <SHT15.h>
@brooksware2000
brooksware2000 / MAX6675_LCD.ino
Created September 5, 2012 00:05
Test sketch for the MAX6675 Type-K Thermocouple Breakout
/*
Demonstration sketch for Hobbybotics MAX6675 Thermocouple breakout board.
Reads temperature from MAX6675 in celsius and fahrenheit. Prints results to I2C LCD.
*/
#include <MAX6675.h>
#include <LCD.h>
#include <Wire.h>