Skip to content

Instantly share code, notes, and snippets.

View shfitz's full-sized avatar
📠
📠📠📠📠

Scott Fitzgerald shfitz

📠
📠📠📠📠
View GitHub Profile
// include the neopixel library
#include <Adafruit_NeoPixel.h>
int ledPin = 3; // the pin the LED data line is connected to
int numLED = 5; // number of LEDs you are controlling
// call the constructor
Adafruit_NeoPixel leds(numLED, ledPin, NEO_GRB + NEO_KHZ800);
int sensorPin = A0; // pin the sensor is attached to
/*
Button LED
This example creates a BLE peripheral with service that contains a
characteristic to control a p5 sketch
The circuit:
Arduino Nano 33 BLE
- Button connected to pin 2
const int ledPin = 2; // the pin that the LED is attached to
void setup() {
// initialize the serial communication:
Serial.begin(9600);
// initialize the ledPin as an output:
pinMode(ledPin, OUTPUT);
}
void loop() {
// include the libraries
#include <WiFiNINA.h>
#include "Adafruit_MQTT.h"
#include "Adafruit_MQTT_Client.h"
// wifi setup
#define WLAN_SSID "networkname"
#define WLAN_PASS "password"
// a.io setup
// based off of Tom Igoe's version here : https://itp.nyu.edu/physcomp/lessons/accelerometers-gyros-and-imus-the-basics
#include <Arduino_LSM9DS1.h>
#include "MadgwickAHRS.h"
// initialize a Madgwick filter:
Madgwick filter;
// sensor's sample rate is fixed at 104 Hz:
const float sensorRate = 104.00;
int firstSensor = 0; // first analog sensor
int secondSensor = 0; // second analog sensor
int thirdSensor = 0; // digital sensor
int inByte = 0; // incoming serial byte
void setup() {
// start serial port at 9600 bps and wait for port to open:
Serial.begin(9600);
while(!Serial){
;;
@shfitz
shfitz / Hbridge.ino
Last active February 25, 2021 21:03
int enablePin= 5;
int ctrl1 = 3;
int ctrl2 = 2;
int button = 4;
int rotDirection = 1;
int buttState = false;
int preState = false;
void setup() {
#include <CapacitiveSensor.h>
// create an instance of the library. pin 2 is the sensor
CapacitiveSensor capsense = CapacitiveSensor(4, 2);
void setup() {
// start serial
Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
}
// color mixing with common cathode rgb led
const int rPin = 4;
const int gPin = 3;
const int bPin = 2;
// value to increment/decrement
int rDir = 1;
int gDir = -1;
int bDir = -1;
@shfitz
shfitz / LDR.md
Last active November 11, 2020 20:10

ldr