Skip to content

Instantly share code, notes, and snippets.

View giantmolecules's full-sized avatar
🧐

Brett Ian Balogh giantmolecules

🧐
  • The Laboratory for Artistic Research and Development
  • Chicago
View GitHub Profile
/*
* Project UNITY-CONTROLLER-FIRMWARE
* Description: UDP controller for Unity
* Author: Brett Ian Balogh
* Email: brettbalogh@gmail.com
* Date: April 11, 2017
* License: CC-BY-SA-NC
*/
// Include Libraries
using UnityEngine;
using System.Collections;
public class screenshot : MonoBehaviour {
void Start () {
}
void Update () {
/*
* Project moving-average-filter
* Description: Filters out noise
* Author: Brett Balogh
* Date: April 29, 2017
* Copyright: CC-BY-SA-NC
*/
#define SENSOR_PIN 0
const int numValues = 100
//
// UnityOSC - Example of usage for OSC receiver
//
// Copyright (c) 2012 Jorge Garcia Martin
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
/*
Define STEP and DIRECTION PINS like:
#define STEP_PIN 1
#define DIR_PIN 2
at the start of the main program.
Put the function below at the end of the main program.
When you want to move, call move(steps, direction) from the main program
*/
void move(int steps, int direction){
// Whichever pin STEP is connected to
#define STEP_PIN 0
// Whichever pin DIR is connected to
#define DIR_PIN 1
void setup(){
pinMode(STEP_PIN, OUTPUT);
pinMode(DIR_PIN, OUTPUT);
}
/*
Smoothing
Reads repeatedly from an analog input, calculating a running average
and printing it to the computer. Keeps ten readings in an array and
continually averages them.
The circuit:
* Analog sensor (potentiometer will do) attached to analog input 0
#define SWITCH_PIN 1
#define LED_PIN 2
Timer bounceTimer(200, bounceFunction, 1);
bool switchValue = 0;
bool switchState = 0;
bool direction = 0;
int fadeCounter = 0;
int fadeVal = 0;
/****************************************
Example Sound Level Sketch for the
Adafruit Microphone Amplifier
****************************************/
const int sampleWindow = 50; // Sample window width in mS (50 mS = 20Hz)
unsigned int sample;
void setup()
{
Timer tempTimer(2000, publishTemp);
int val = 0;
float voltage = 0.0;
float temperatureC = 0.0;
void setup() {
pinMode(A0, INPUT);
Serial.begin(115200);
}