Skip to content

Instantly share code, notes, and snippets.

import processing.serial.*;
import processing.video.*;
Capture cam;
int Size = 10;
Serial myPort;
int valueFromArduino;
ArrayList<Ball> balls = new ArrayList<Ball>();
void setup() {
size(500, 600);
noStroke();
balls = new ArrayList<Ball>();
for (int i=0; i<20; i++) {
balls.add(new Ball(width/2, height/2, random(30,75)));
}
// IMA NYU Shanghai
// Interaction Lab
// For sending multiple values from Arduino to Processing
void setup() {
Serial.begin(9600);
}
void loop() {
// IMA NYU Shanghai
// Interaction Lab
/**
This example is to send multiple values from Processing to Arduino.
You can find the Processing example file in the same folder which works with this Arduino file.
Please note that the echo case (when char c is 'e' in the getSerialData function below)
checks if Arduino is receiving the correct bytes from the Processing sketch
by sending the values array back to the Processing sketch.
int r = 80;
int i = 1;
int a = 300;
int b = 300;
int c = 0;
void setup(){
size(600,600);
frameRate(150);
colorMode(HSB);
}
String[] lines;
int xpos=300;
int ypos=350;
void setup() {
size(600, 600);
background(200, 50, 50);
rectMode(CENTER);
}