Skip to content

Instantly share code, notes, and snippets.

View bevchou's full-sized avatar

Beverly Chou bevchou

View GitHub Profile
@bevchou
bevchou / lunar-lander-controller.ino
Last active January 31, 2018 04:32
tangible interaction - code (done) for lunar lander game controller
#include <Encoder.h>
#include <Keyboard.h>
#include <Mouse.h>
//encoder pins are on 6 and 7
Encoder myEnc(6, 7);
//previous encoder position
long prevPosition = -999;
//encoder momentary button
@bevchou
bevchou / HomemadeHardware_ATtiny85_LED.ino
Created January 28, 2018 20:35
Arduino code to control an ATtiny85 which will either blink an LED or fade up/down an LED depending on the position of a toggle switch
//pins used
int sensorPin = 3;
int LEDpin = 4;
//light brightness
int brightness = 0;
int fadeRate = 3;
void setup() {
Serial.begin(9600);
pinMode(LEDpin, OUTPUT);
@bevchou
bevchou / RandomCharController.cs
Created December 16, 2017 20:56
Code to control character in my unity project
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RandomCharController : MonoBehaviour {
private Animator myAnimator;
// Use this for initialization
void Start () {
class Imgcloud {
constructor(img, r, theta, theta_vel) {
//pass to class
this.img = img;
this.r = r;
this.theta = theta;
this.theta_vel = theta_vel;
//other variables
this.x = 0;
this.y = 0;
function updateNoun() {
//do not allow user to input white space or empty string into the word array
if (trim(nounInput.value()) != "") {
//push input to word array
nounArray.push(nounInput.value());
//display submitted words below input field
nounPara.push(createP(nounInput.value()));
for (let i = 0; i < nounPara.length; i++) {
nounPara[i].position(nounInpX, inpY + 20 * (i - 1));
}
@bevchou
bevchou / p5 and clmtracker.js
Created November 28, 2017 08:02
got p5 and clmtracker working together
//webcam
let video;
let vidWidth = 600;
let vidHeight = 450;
//clm trackr
let facepos;
let ctracker;
function setup() {
//get webcam
//input fields
let inpH = 550;
//name
let nameInput;
let newName = "Who is this?";
//nouns
let nounInput;
let nounArray = [];
let nounPara = [];
//adjectives
let canvas;
let video;
let factor = 10;
let thresholdSlider;
//pentatnoic scale freq in hz starting on middle C
//https://pages.mtu.edu/~suits/notefreqs.html
//C, D, E, G, A, C
let pentatonic = [261.63, 293.66, 329.63, 392, 440, 523.25];
let musicBarSlider;
let sounds = [];
//keep track of gifs
let currentGif; //the file path
let image; //the actual image
//API info
let APIkey = "3GGsEajJUSgykXGpw4EeN6QYY5w5Ve7G";
let numGif = 25;
let queryLeft;
let queryRight;
let giphyLeftData;
let giphyMiddleData;
<body>
<script src="sketch.js"></script>
<h1>click 4 gif</h1>
<div id="gif"></div>
<div id="slider">
<input value="cat" style="right: 50%; margin-right: 180px;" class="keep" id="leftInput" />
<input value="dog" style="left: 50%; margin-left: 180px;" class="keep" id="rightInput" />