LEDRoom – Quick Prototyping

Recap of the chosen sketch for development:

I adapted LP’s LedShakeSimulation.pde to utilise the feedback from my phone’s accelerometer to change the “brightness” of the LED strip. Communication from Processing to Arduino uses Serial Communication and MaxtoArduino.ino .

As I only wanted the strip to go from “dark” to “light”, I did not need all three r,g,b values to differ.

void accel( float x, float y, float z) {
  r = (int) map(x, 0, 0.9, 0, 255);
  g = (int) map(y, -1.0, 0.5, 0, 255); //faster = brighter
  b = (int) map(z, 1.0, -1.0, 0, 255);
  println("Accel : ", x, y, z);

void draw() {
  background( g, g, g) ;
  //writing to arduino
  myPort.write(255); //dead value?
  myPort.write(g); //r
  myPort.write(g); //g
  myPort.write(g); //b

I need to calibrate my code and find the gradient=0 value when tossing my phone in the air. Only after this will I be able to have the lighting brighten and dim as the phone rises and falls.

Maybe I will try using Gravity.

Leave a Reply