Pages: [1]   Go Down
Author Topic: Arduino Analog values into Processing!  (Read 370 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
« Last Edit: May 25, 2011, 09:15:55 pm by Siknature » Logged

Manchester (England England)
Offline Offline
Brattain Member
Karma: 639
Posts: 34726
Solder is electric glue
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?

Pages: [1]   Go Up
Jump to: