Skip to content

Instantly share code, notes, and snippets.

@fergfluff
fergfluff / Sparkfun_Sample_Code_AT42QT101X
Created March 24, 2018 19:54
Sparkfun's sample code for AT42QT101X board
//Thanks to Sparkfun, here is sample code for the AT42QT101X board.
//Found here: https://learn.sparkfun.com/tutorials/at42qt101x-capacitive-touch-breakout-hookup-guide#example-code
/*
Open the Arduino program and paste the following code into the sketch:
12-23-2013
SparkFun Electronics 2013
Shawn Hymel
This code is public domain but you buy me a beer if you use this
@fergfluff
fergfluff / Lighting Controller
Last active March 7, 2018 07:00
Lighting Controller
//Coemar Color Light Datasheet
//http://www.coemar.com/media/file/DMX-Chart-Reflection-LEDko-FullSpectrum-Series-2-4.pdf
//Magic Sheet Number
//21 – Intensity
//22 – Red
//23 – Green
//24 – Blue
//25 - White
//Features
const int volumeSoftPot = A0;
const int percussionPiezo = A1;
const int cButton = 6;
const int dButton = 7;
const int eButton = 8;
const int fButton = 9;
const int gButton = 10;
//int previousNote = 0;
//int previouspercussionPiezo = 0;
/*
Lunar Lander Gear:
One button to start game
One button for left arrow movement
One button for right arrow movement
One button for thrust/using fuel
*/
#include "Keyboard.h"
//VARIABLES FOR SERIAL IN P5 SKETCH
let serial; // variable to hold an instance of the serialport library
let portName = '/dev/cu.usbmodem119'; // fill in your serial port name here
//VARIABLES FOR WORDS AND MP3S ASSOCIATED WITH SOUNDS
let mouth0Sensor = ['Ahh', 'Aohh', 'Aye', 'Ehh', 'Ooh', 'Uhh', 'Hah', 'Jyah'];
let mouth0Index = 0;
//BIRD API VARIABLES
var data;
var birdAPI = 'http://ebird.org/ws1.1/data/obs/geo/recent?lng=';
var distance = '&dist=50';
var back = '&back=1';
var maxResults = '&maxResults=10';
var format = '&fmt=json'
var inputLat;
var inputLgn;
var viewImageButton;
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.11/p5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.11/addons/p5.dom.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.11/addons/p5.sound.min.js"></script>
<link rel="stylesheet" type="text/css" href="style.css">
<link href="https://fonts.googleapis.com/css?family=Asap" rel="stylesheet">
</head>
let serial; // variable to hold an instance of the serialport library
let portName = '/dev/cu.usbmodem115'; // fill in your serial port name here
function setup() {
createCanvas(400, 400); // make canvas
smooth(); // antialias drawing lines
serial = new p5.SerialPort(); // make a new instance of the serialport library
serial.on('list', printList); // set a callback function for the serialport list event
void setup() {
Serial.begin(9600);
while (Serial.available() <= 0) {
Serial.println("hello");
delay(300);
}
}
void loop() {
var serial; // variable to hold an instance of the serialport library
var portName = '/dev/cu.usbmodem104'; // fill in your serial port name here
var ball1size;
var ball2size;
var ball3size;
function setup() {
createCanvas(480, 480); // make canvas
smooth(); // antialias drawing lines