Skip to content

Instantly share code, notes, and snippets.

/*************************************************
* Public Constants
*************************************************/
#define NOTE_B0 31
#define NOTE_C1 33
#define NOTE_CS1 35
#define NOTE_D1 37
#define NOTE_DS1 39
#define NOTE_E1 41
/*
WiFi Alarm
by Nahla Ibrahim & Amber Nomani
Network Everything Spring 2016
Data is logged at: https://thingspeak.com/channels/98384
Base code adapted from WiFi 101 ThingSpeak Data Uploader http://arduino.cc/en/Tutorial/WiFi101ThingSpeakDataUploader
*/
class Car {
//color c;
float xPos;
float yPos;
float ySpeed;
PImage squir;
// The Constructor is defined with arguments.
Car() {
xPos = width/2;
yPos = 40;
//code for looping background from: https://forum.processing.org/two/discussion/12084/looping-background-image
//code for car is from Scott F.
import processing.serial.*; // import the Processing serial library
Serial myPort; // instance of the setial object
float moveX, speed; //variables for the 'player'
float inByte; // variable for the car speed
@ambernomani
ambernomani / Game Controller
Created February 14, 2016 19:44
game_controller
// code for the RGB LED is adapted from sparkfun website
//L for left and R for right
int ledPinL = 13;
int switchPinL = 2;
int ledPinR = 12;
int switchPinR = 7;
int switchStateL;
int switchStateR;
var raindrops = new Array(100);
var raindrops2 = new Array(400);
var snow = new Array(20);
var clouds = new Array(30);
var cw;
var stop = 90;
var n = 0; m = 0;
function Snowflake(x1, y1) {
//this.x = x1;
//this.y = y1;
this.h = random(30);
//this.speed = random(1,3);
this.pos = createVector(x1, y1); // for position
this.vel = createVector(0, 0); // for velocity
this.acc = createVector(0, 0)
//this.r = 16;
function Rain(){
this.pos = createVector (random(799), random(799));
this.height = random (50,130);
this.vel = createVector(0,random(1,4))
this.acc = createVector (0, 1)
this.applyForce=function(force){
this.acc.add(force);
}
function Cloud(x1, y1){
this.pos = createVector (x1, y1);
this.vel = createVector(0,0);
this.scale= random(0.2, 1.2);
//this.acc=createVector(0,0);
this.applyForce = function(force){
this.vel.add(force);
}
function colorWheel() {
this.move = function(stop, bp) {
colorMode(HSB, 360, 100, 100);
angleMode(DEGREES);
for (i = 90; i < stop; i++) {
fill(i%360, 100, 100);
stroke(i%360, 100, 100);
arc(700, 90, 130, 130, i, i+1)