Multiple sensors from Arduino Uno

drewmcm's icon

Hi everyone,

I know many people have been working and posting on Arduino & MaxMSP and connecting sensors...

I'm having an isue where I'm using an Ultrasonic Sensor, a breath/air pressure sensor, and an analogue slider together - they all seem to work fine indipendantly if I isolate their lines of code in arduino.

But when put together, I get fluctuating in the numbers coming into Max. Each input keeps jumping from the read value to 0, and then back.

Simple max patch attached, and arduino code image

Any help greatly aporeciated

dREw

Slide-APhone Sensors Input.maxpat
Max Patch


Source Audio's icon

Don't print anything else than just you sensors.

why bother with that messages in Max ?

prepend a letter for each of them and send only if value changed.

example for pressure

Serial.print( "p "); Serial.println(pressure value);

in max then route p d s for pressure, distance and slider.

next mistake is setting all 3 sliders to read from same analog input

and also using 0 instead of A0, A1 A2 etc

simplest example for 1 slider

you could also add a bit of change threshold if readings are

not stable

drewmcm's icon

Thanks so much,,

Your solutions have worked well. I don’t know why I haven’t noticed some of those issues myself at the time, just the process of learning I guess

Thanks again

Drew