Hey! I just recently got into playing around with arduino and processing. And I came up with a little project and I have run into a few issues.
So the little project I have is this. I have the Arduino, and connected on a breadboard 3 variable resistors connecting to A0, A1, A2. Pretty simple. What I want to do is send the data from each resistor to a processing program and simply control a shape. Size and X and Y position.
int val1 = 0; int val2 = 0; int val3 = 0; int sensorPin1 = A0; int sensorPin2 = A1; int sensorPin3 = A2;
The code on the board.
My issue is that when I get it into processing it doesn't seem like very consistent data. In the serial monitor on the board it looks good. But not so much from processing. I also have a question about mapping the variable.
import processing.serial.*;
Serial port; float valS; float valX; float valY;
void setup(){ size(800, 800); // println(Serial.list()); String arduinoPort = Serial.list()[0]; port = new Serial(this, arduinoPort, 9600);
That is the processing code I am currently working with. Import the serial Library, connect to the board and then this is where I am a little lost/think I am going something wrong. I call .read on my port (is this and object or a class?) and I assign it to the variables, but I never tell it that the sensor connected to A0 I want to be valS (size) etc. How do I go about doing that? Is there a way to see what is being sent to the program from the board and assign it to variables?
If I could get a little help on this that would be great! If something doesn't make sense let me know.