Skip to content

Instantly share code, notes, and snippets.

View bboyho's full-sized avatar

Ho Yun "Bobby" bboyho

View GitHub Profile
/******************************************************************************
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).**
/*
SparkFun Inventor’s Kit
Circuit 1C-Photoresistor
Use a photoresistor to monitor how bright a room is, and turn an LED on when it gets dark.
This sketch was written by SparkFun Electronics, with lots of help from the Arduino community.
This code is completely free for any use.
View circuit diagram and instructions at: https://learn.sparkfun.com/tutorials/sparkfun-inventors-kit-experiment-guide---v40
/*
SparkFun Inventor’s Kit
Circuit 1C-Photoresistor
Use a photoresistor to monitor how bright a room is, and turn an LED on when it gets dark.
This sketch was written by SparkFun Electronics, with lots of help from the Arduino community.
This code is completely free for any use.
View circuit diagram and instructions at: https://learn.sparkfun.com/tutorials/sparkfun-inventors-kit-experiment-guide---v40
@bboyho
bboyho / APDS9301_NightLightTest.ino
Last active March 7, 2019 10:47
Test of the APDS9301
#include "Wire.h"
#include <Sparkfun_APDS9301_Library.h>
APDS9301 apds;
#define INT_PIN 2 // We'll connect the INT pin from our sensor to the
// INT0 interrupt pin on the Arduino.
bool lightIntHappened = false; // flag set in the interrupt to let the
// mainline code know that an interrupt occurred.
int threshold = 26;
// 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 / OpenLCD_Custom_Character.ino
Created February 7, 2019 21:48
Testing Custom Character code
/*
OpenLCD is an LCD with Serial/I2C/SPI interfaces.
By: Nathan Seidle
SparkFun Electronics
Date: November 12th, 2015
License: This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license).
OpenLCD gives the user multiple interfaces (serial, I2C, and SPI) to control an LCD. SerLCD was the original
serial LCD from SparkFun that ran on the PIC 16F88 with only a serial interface and limited feature set.
This is an updated serial LCD.
/* Modified FastLED example to stress test power supplies
* by using long lengths of LED strips and setting brightness
* to max. This was used in the Mean Well LED Switching Power
* Supply Hookup Guide on WS2812-based LEDs.
*
* https://learn.sparkfun.com/tutorials/mean-well-led-switching-power-supply-hookup-guide/
*
* However, it can be be used on other addressable
* LED chipsets by adjusting the LED_type.
*/
/* Arduino.cc RGB Crossfade
https://www.arduino.cc/en/Tutorial/ColorCrossfader
Modified by Bobby with Custom Color Mixing
https://learn.sparkfun.com/tutorials/lilypad-protosnap-plus-activity-guide/3-custom-color-mixing
https://learn.sparkfun.com/tutorials/picobuck-hookup-guide-v12
Code for cross-fading 4 LEDs, red, green, blue, and white (RGBW)
To create fades, you need to do two things:
1. Describe the colors you want to be displayed
2. List the order you want them to fade in
#include "pitches.h" // must include open source pitches.h found online in libraries folder or make a new tab => https://www.arduino.cc/en/Tutorial/toneMelody
int button1State = LOW;
void setup() {
pinMode(4, INPUT_PULLUP);
pinMode(5, OUTPUT);
}