Skip to content

Instantly share code, notes, and snippets.

View natendaben's full-sized avatar

Nate Bennett natendaben

View GitHub Profile
@natendaben
natendaben / 14erChecklist_iOS.swift
Last active February 27, 2020 03:27
Psuedocode for iOS version of 14er Checklist app
//Data model: Property List
<plist version="1.0">
<array> //array of mountain ranges
<dict> //mountain range object
<key>totalNumber</key> //total # mountains in that range
<integer>6</integer>
<key>range</key> //name of mountain range
<string>Front Range</string>
<key>mountains</key> //array of mountain objects
<array>
@natendaben
natendaben / NeopixelTransitions.ino
Created January 23, 2020 00:35
Smooth color transitions with Neopixels and RFID tags
#include <SPI.h>
#include <MFRC522.h>
#define SS_PIN 53 //SDA Pin
#define RST_PIN 5
MFRC522 mfrc522(SS_PIN, RST_PIN); // Instance of the mfrc522 class
#include <FastLED.h> //FastLED library
#define FIRST_STRIP_NUM_LEDS 5 //ONLY FOR FIRST LED STRIP
#define SECOND_STRIP_NUM_LEDS 10 //ONLY FOR FIRST LED STRIP
@natendaben
natendaben / Fade.ino
Created December 5, 2019 07:12
A pulsing effect for Neopixels
#include <Adafruit_NeoPixel.h>
#define PIN 6
Adafruit_NeoPixel strip = Adafruit_NeoPixel(16, PIN, NEO_GRB + NEO_KHZ800);
// Desert - Gold / brown
uint32_t desert = strip.gamma32(strip.Color(255, 183, 0));
// Underwater - Deep blues / dark
uint32_t water = strip.gamma32(strip.Color(0, 32, 194));
// Rainforest - Deep greens / dark
uint32_t forest = strip.gamma32(strip.Color(0, 179, 116));
@natendaben
natendaben / rfid_prototype.ino
Created December 5, 2019 01:54
Using RFID technology to change Neopixel strip based on different tags
#include <SPI.h>
#include <MFRC522.h>
#define SS_PIN 53
#define RST_PIN 5
#include <Adafruit_NeoPixel.h>
#define PIN 22
Adafruit_NeoPixel strip = Adafruit_NeoPixel(5, PIN, NEO_GRB + NEO_KHZ800);
MFRC522 mfrc522(SS_PIN, RST_PIN); // Instance of the class
@natendaben
natendaben / MyBoulderAndroid.txt
Created November 17, 2019 05:38
Psuedocode for Android version of MyBoulder app
// Each pre-defined idea will be stored in an object that has a title, an image,
// a description, an address, a category, and various booleans for season compatibility
// and whether or not the activity costs money.
// Example:
public class Idea{
private String title; //name of activity
private String imageName; //name of image for activity
private String description; //short description
private String address; //address of activity location
@natendaben
natendaben / MyBoulder.txt
Last active October 1, 2019 05:54
MyBoulder PsuedoCode
// Each pre-defined idea will be stored in an object that has a title, an image,
// a description, an address, a category, and various booleans for season compatibility
// and whether or not the activity costs money.
// Example:
struct Idea{
var title : String = "" //name of activity
var imageName : String = "" //name of image for activity
var description : String = "" //short description
var address : String = "" //address of activity location
@natendaben
natendaben / finalcode.ino
Created December 16, 2018 20:27
Final Code for Virtual Nature Box
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
//pin that the strip is connected to
#define PIN 5
//first argument is # pixels - change to how many you haveAdafruit_NeoPixel strip = Adafruit_NeoPixel(10, PIN, NEO_GRB + NEO_KHZ800);
@natendaben
natendaben / stepper.ino
Created November 16, 2018 00:42
Stepper Motor
//Declare pin functions on Redboard
#define stp 2
#define dir 3
#define MS1 4
#define MS2 5
#define EN 6
//Declare variables for functions
char user_input;
int x;
@natendaben
natendaben / DCmotor.ino
Created November 16, 2018 00:18
DC Motor Code
const int switchPin = 2; // switch input
const int motor1Pin = 3; // H-bridge leg 1 (pin 2, 1A)
const int motor2Pin = 5; // H-bridge leg 2 (pin 7, 2A)
const int enablePin = 9; // H-bridge enable pin
void setup() {
// set the switch as an input:
pinMode(switchPin, INPUT);
// set all the other pins you're using as outputs:
@natendaben
natendaben / servo.ino
Created November 16, 2018 00:01
Servo Code
#include <Servo.h>
//make instance of servo object
Servo mike;
void setup() {
// put your setup code here, to run once:
//attach servo motor