1

Hi-

Thanks for the information about how to communicate from Arduino to max/msp. I have had success with digital and analog input but now I want to send messages back out to Arduino from Max.

For instance, I have a counter object tracking the amount of time someone stands on a floor switch. I want to set off a piezo buzzer if the person stands there for a certain length of time. How would I program the patch to trigger a digital pin on the Arduino high or low?

Any suggestions would be greatly appreciated!

Lisa Marie

closed as off-topic by Mark, Rory Alsop Jun 3 at 19:42

  • This question does not appear to be about sound design, within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    I'm voting to close this question as off-topic because there is nothing in this question that relates to sound-design. – Mark Jun 2 at 22:52
0

How you could do it is by using the PWM of the digital pins on the Arduino. PMW means Pulse Width Modulation, and what happens is that it switches on and off very quickly. This way you can control the piezzo buzzer. The faster the pulse, the higher the pitch.

  • Step 1: Check on your Arduino board which digital pins accept PWM. For now, let's say you use pin number 2.

  • Step 2: Put the + (red) side of the piezzo into pin 2 (or the one you chose with PWM). And put the - (black) side on ground. Check this tutorial for a bit more details.

  • Step 3: In the Max patch that talks to your Arduino (arduino_test.maxpat), the first section is called digital Pin mode, there you want to set the pin you chose on your Arduino to be set to PWM.

    alt text
    (source: soundplusdesign.com)

  • Step 4: In the PWM section of the arduino_test patch, select pin number 2 from the [Umenu].

    alt text
    (source: soundplusdesign.com)

  • Step 5: Set up your trigger that happens from the person standing on the floor switch to activate the slider for the PWM. Maybe connect the counter to the PWM slider so that the longer the person stands on the switch, the higher the value of the slider, and thus the pitch of the buzzer.

Does this work for you? Let me know if it doesn't. Good luck.

Not the answer you're looking for? Browse other questions tagged or ask your own question.