Go Down

Topic: Arduino Analog values into Processing! (Read 727 times) previous topic - next topic


May 26, 2011, 04:05 am Last Edit: May 26, 2011, 04:15 am by Siknature Reason: 1
Im doing a project at the moment where i am using flex sensors to measure texture. These flex sensors are read by arduino as analog values. These values I want to be sent to processing. I  have downloaded the Serial library for processing to do this. BUt despite researching all day I haven't been able to find a way to store the readings from the flex sensors into a variable in processing.

Here is my arduino code:
const int analogInPin = A0;  
const int analogInPin2 = A5;
const int analogOutPin = 9;
const int analogOutPin2 = 9;

int sensorValue = 0;        
int sensorValue2 = 0;  
int outputValue = 0;        
int outputValue2 = 0;

void setup() {


void loop() {
 // read the analog in value:
 sensorValue = analogRead(analogInPin);            
 sensorValue2 = analogRead(analogInPin2);  
 outputValue = map(sensorValue, 0, 1023, 0, 255);  
 outputValue2 = map(sensorValue2, 0, 1023, 0, 255);

 analogWrite(analogOutPin, outputValue);          
 analogWrite(analogOutPin2, outputValue2);

 Serial.print("\t output A0= ");      
 Serial.print("\t output A5= ");      


So my question is can anybody send me a code that can store 2 analog variables from arduino in processing?

I have written this processing code but I am positive that it is completely wrong haha:
import processing.serial.*;
import cc.arduino.*;

Arduino arduino;
float myValue;
float myValue2;

void setup()
arduino = new Arduino(this, Arduino.list()[0], 9600);

void draw()
myValue = arduino.analogRead(0);
myValue2 = arduino.analogRead(5);

Thanks in advance!


The front of this section says:-
No New Posts    Installation & Troubleshooting
For problems with Arduino itself, NOT your project

What part of "NOT your project" do you not understand?

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131