Skip to content

Instantly share code, notes, and snippets.

View bboyho's full-sized avatar

Ho Yun "Bobby" bboyho

View GitHub Profile
/******************************************************************************
template.ino
Template
WRITTEN BY:
@ SparkFun Electronics
DATE:
GITHUB REPO:
DEVELOPMENT ENVIRONMENT SPECIFICS:
Firmware developed using Arduino IDE v1.8.9
@bboyho
bboyho / teensy_3_1_xbee_UART1_example.ino
Created October 16, 2019 05:55
Test of Teensy XBee Adapter
//Serial test using the hardware uart on pins 0/1 (UART1).
//Connect an XBee and Teensy 3.1 to the adapter board
//Connect an XBee to a serial terminal of your choice (USB dongle for example)
//
//Characters sent out the XBee terminal go:
// Onto the airwaves -> into UART1 RX -> out the serial monitor
//
//Characters sent out the serial monitor go:
// Out the UART1 TX pin -> onto the airwaves -> out the SBee serial terminal
//
//Debug mode, comment one of these lines out using a syntax
//for a single line comment ("//"):
//#define DEBUG 0 //0 = LEDs only
#define DEBUG 1 //1 = LEDs w/ serial output
// Define our LED pins:
#define redPin 5
#define greenPin 6
#define bluePin 9
/*
Non Addressable RGB LED: Custom Color Mixing
Written by: Ho Yun "Bobby" Chan and Gella
SparkFun Electronics
1M Bare - https://www.sparkfun.com/products/12021
1M Sealed - https://www.sparkfun.com/products/12023
5B Bare - https://www.sparkfun.com/products/12022
5M Sealed - https://www.sparkfun.com/products/12024
/*
Reading a serial ASCII-encoded string.
This sketch demonstrates the Serial parseInt() function.
It looks for an ASCII string of comma-separated values.
It parses them into ints, and uses those to fade an RGB LED.
Circuit: Common-Cathode RGB LED wired like so:
- red anode: digital pin 3
- green anode: digital pin 5
// We'll use SoftwareSerial to communicate with the XBee:
//#include <SoftwareSerial.h>
//For Atmega328P's
// XBee's DOUT (TX) is connected to pin 2 (Arduino's Software RX)
// XBee's DIN (RX) is connected to pin 3 (Arduino's Software TX)
//SoftwareSerial XBee(2, 3); // RX, TX
//For Atmega2560, ATmega32U4, etc.
@bboyho
bboyho / PIR_Screensaver_wake-up.ino
Last active August 18, 2020 22:22
PIR_Screensaver_wake-up.ino
/******************************************************************************
PIR_Screensaver_wake-up.ino
Modified by: Ho Yun "Bobby" Chan
June 4th, 2019
Original sketch for SparkFun's PIR Motion Detector
(https://www.sparkfun.com/products/13285)
Jim Lindblom @ SparkFun Electronics
May 2, 2016
@bboyho
bboyho / primary_sec_tertiary.ino
Created March 20, 2019 05:32
color mixing tests with two 180Ohm and one 100Ohm resistor
#include <SoftwareSerial.h>
SoftwareSerial xbee(2, 3); //Rx = 2, Tx = 3
//Declare variables and pin definitions
//SEND Button
const int button1Pin = 4; //push button
const int ledPin1 = 13; //LED on the push button
/******************************************************************************
servo-skatch.ino
Example sketch for connecting a hobby servo to a sparkfun redboard
(https://www.sparkfun.com/products/9065)
(https://www.sparkfun.com/products/12757)
Byron Jacquot@ SparkFun Electronics
May 17, 2016
**SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT).**