Skip to content

Instantly share code, notes, and snippets.

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

Scott Fitzgerald shfitz

📠
📠📠📠📠
View GitHub Profile
// 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
@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() {
/*
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 <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);
}
// 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;
// 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

// constants for the pins
const int ledPin = 2;
const int potPin = A7;
void setup() {
// set the led pin as an output
pinMode(ledPin, OUTPUT);
// open the serial port for communication
Serial.begin(9600);