Rigging potentiometers for colour change and speed in Processing and Firmata

This is my first excursion into Arduino so needless to say I’m a little unsure as to how to go about rigging some of my potententiometers.

I’m working on a project where I am using my arduino as an input device for a processing sketch, where my dials control the speed of the on screen animation, the colour, and the rotation axis. I have an obs file in my sketch which I am trying to manipulate with the potentiometers.

I have manages to configure the speed function but the movement and colour changes are giving me some trouble. I don’t really know how to go about it and and insight would be greatly appreciated.

I have a total of 4 potentiometers

I’ll drag and drop my code below from Processing so anyone reading this can make sense of what is going on.

import processing.serial.*;

import cc.arduino.*;

Arduino arduino;
float x, y, z;
int A, B, C, D;
PShape coolshape;

float ry;


public void setup() {

  println(Arduino.list());


  arduino = new Arduino(this, Arduino.list()[0], 57600);

  for (int i = 0; i <= 13; i++)
    arduino.pinMode(i, Arduino.INPUT);

  size(1000, 1000, P3D);

  coolshape = loadShape("control_shape.obj");
}

public void draw() {
  background(0);
  lights();

  stroke(255);
  noFill();
  rectMode(CENTER);
  rect(width/2, height/2, 700, 700);



  A=arduino.analogRead(0);
  float a=map(A, 0, 1023, 0, 5);
  print("a:");
  println(a);

  B=arduino.analogRead(1);
  float b=map(B, 0, 1023, 0, 100);
  print("b:");
  println(b);
  fill(D, 255, 0, 5);

  C=arduino.analogRead(2);
  float c=map(C, 0, 1023, 0, 100);
  print("c:");
  println(c);


  D=arduino.analogRead(3);
  float d=map(C, 0, 1023, 0, 100);
  print("d:");
  println(d);


  translate(width/2, height/2+100, -200);
  scale(50.0, 50.0, 50.0);
  rotateZ(PI);
  rotateY(ry);
  shape(coolshape);

  ry += a;
}

but the movement and colour changes are giving me some trouble.

You didn't tell us what trouble you are having. Hard to help without knowing what you need help with.

Hi, Please post [u]all of the arduino code[/u] so we can see what you are sending.

Can you post a screen shot of the serial monitor when it is reading the arduino serial output? Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

We need to establish the you are sending the correct data.

Thanks.. Tom.. :)