Skip to content

Instantly share code, notes, and snippets.

View ericjforman's full-sized avatar

Eric Forman ericjforman

View GitHub Profile
#include <FastLED.h>
// LED stuff
#define DATA_PIN 3
#define NUM_LEDS 30 // will be 500
#define MAX_POWER_MILLIAMPS 6000
#define LED_TYPE WS2812B
#define COLOR_ORDER GRB
CRGB leds[NUM_LEDS];
@ericjforman
ericjforman / capSense_example.ino
Last active October 19, 2021 17:37
Capacitive Sensor
#include <CapacitiveSensor.h>
/*
CapitiveSense Library Demo Sketch
Paul Badger 2008
modified by Eric Forman 2017
Install library from Arduino IDE: Go to Sketch / Include Library / Manage Libraries, then search for "capacitiveSensor"
and select library by Paul Badger, Paul Stoffregen, select latest version, click Install.
@ericjforman
ericjforman / gist:5214240
Created March 21, 2013 16:06
Graph smoothed and converted sensor value
/* reads a sensor on pin A0 and sends raw and smoothed values via serial, comma-separated.
Sends COMMA-SEPARATED values in the range 0 to 1023, followed by a newline, or newline and carriage return.
Use with "graphMultiple" processing code
Created April 2011 by Eric Forman
Updated March 21 2013 by Eric Forman
*/
const int PinA = A0;
@ericjforman
ericjforman / gist:5214234
Created March 21, 2013 16:05
Sensor smoothing function
/* Sensor smoothing
by Eric Forman [www.ericforman.com]
Original version 2008, updated May 2012
Smooths sensor readings by adding only a fraction of new values.
The more the new value is divided, the smaller the change, thus a smoother result
As with any smoothing function, the more you smooth, the slower the response time
*/
int sensorPin = 0; // sensor input pin