Skip to content

Instantly share code, notes, and snippets.

// Libraries
import processing.serial.*;
import cc.arduino.*;
//Calling Arduino Ports
//Numbers represent pins
Arduino arduino;
@Obaid2902
Obaid2902 / Part A
Created February 13, 2016 04:24
Tutorial 3
//use arrow keys to increase or decrease the speed of the object
//dependng on where the your mosue is on the canvas you will get a different shade of colors
// these are for the positioning of the squares
float x = 100;
float y = 100;
float xSpeed = 2;
float ySpeed = 3;
// mapping so that my colors and mouse positioning are nice and free to roam
float Color = map(mouseX, 0, 900, 0, 500);
float Color2 = map(mouseY, 0, 900, 0, 500);
const int LED = 9; // the pin for the LED
const int BUTTON = 7; // input pin of the pushbutton
int val = 0; // stores the state of the input pin
int old_val = 0; // stores the previous value of "val"
int state = 0; // 0 = LED off while 1 = LED on
int brightness = 128; // Stores the brightness value
unsigned long startTime = 0; // when did we begin pressing?
void setup() {
pinMode(LED, OUTPUT); // tell Arduino LED is an output
pinMode(BUTTON, INPUT); // and BUTTON is an input
float myLat = 0;
int led1 = 11;
int led2 = 10;
void setup()
{
// Open serial port between app and LilyPad:
Serial.begin(9600);
// setting up the pinModes
pinMode(led1, OUTPUT);