Go Down

Topic: sending arduino data from multiple sensors to Pure Data (Read 1 time) previous topic - next topic


I am very new to this, so forgive my ignorance...

I am trying to send data from a force sensor and four flex sensors on an arduino uno to PD on my mac. I want to then translate the data into MIDI and DMX messages. I am stuck on getting the values routed properly in PD. Here is my arduino code:


int thumbForcePin = 4;
int indexFlexPin = 3;
int middleFlexPin = 2;
int ringFlexPin = 1;

void setup()

void loop()

  String data = "";
  int thumbval = analogRead(thumbForcePin);
  thumbval = constrain(thumbval, 320, 560);
  int thumblevel = map(thumbval, 320, 560, 127, 0);
  data = data + "[" + thumblevel + ";";

  int indexval = analogRead(indexFlexPin);
  indexval = constrain(indexval, 320, 560);
  int indexlevel = map(indexval, 320, 560, 127, 0);
  data = data + indexval + ";";

  int middleval = analogRead(middleFlexPin);
  middleval = constrain(middleval, 320, 560);
  int middlelevel = map(middleval, 320, 560, 127, 0);
  data = data + middlelevel + ";"; 

  int ringval = analogRead(ringFlexPin);
  ringval = constrain(ringval, 320, 560);
  int ringlevel = map(ringval, 320, 560, 127, 0);
  data = data + ringval + "]";


I have been successful using comport to get the values from one sensor. But I'm not sure how to handle the list. I guess I am currently sending a string via Serial.print() ...does anyone know how to convert the data through comport so that I can unpack in Pure Data? Would I be better off using pduino or SMS? Thanks so much for any help!


Hi!! Have you figured out how to do that? I'm even newer than you and in a rush trying to fix my degree project. If you can please explain how you did that; it will be so highly appreciated!


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