Recieving sensor data in processing

Hello

Thank you for welcoming me to your forum.

I'm very new to Arduino, and to Processing. I was hoping someone could point me in the direction of a tutorial, or offer advice on conecting a sensor to Processing via Arduino. I'd like to visualise sensor data in Processing, in this case, a light sensor, but ultimately I'd like to show visuals derived from proximity i.e. a person walking towards a sensor.

I've had a good look around, and I can see tutorials for opperating Arduino with Processing, but very little for the other way round.

All and any help would be appreciated.

Andy

I can see tutorials for opperating Arduino with Processing, but very little for the other way round.

If you've looked at those tutorials, you'll see that Processing sends serial to the Arduino to read, collect, and parse.

Well, guess what. The Arduino can send serial data that Processing reads, collects, and parses.

On the arduino side

Void setup(){ Serial.begin(9600); } Void loop(){ analogRead(1); value = analogRead(1); Value = map(value, 0, 1023, 0, 255); Serial.print(value); }

On processing side once you have serial port set up like in the example in processing

If(Serial.available > 0){ Raw = myport.read(), if(raw != 10 && raw != 13){ Value = raw; } }

// then use the obtained value in your graphic of choice eg Background(255), Line(0, 10, value, 10);

That would be as simple as it gets

This is a great start - thank you very much. Using a Ping sensor, do I replace analogRead with digitalRead?

Using a Ping sensor, do I replace analogRead with digitalRead?

Have you written ANY code to get data from the Ping sensor? Or stolen/borrowed any? If so, then you know what kind of data to send to Processing. If not, start looking. If you want someone to write the code for you, go to gigs and collaborations, and make an offer to pay for the help.

Ive never used a ping sensor before so idk but if it is just digitalread then u also need to remove the map command