Arduino Music - Vibration Device

ila kal's icon

Hello everyone,

I am very much a beginner on both arduino and max msp, so would really appreciate your help.

I am working on creating a music-sensitive vibration. I was able to create a way to detect the lowfrequency sounds in max msp through lores~, and so on (the patch attached)

However, I am constantly having a problem to get the data read by arduino. Often, it doesn't show any data at all, or doesn't get connected to MAX. What am I doing wrong? Is it a workflow problem or can it be that my lillypad (the arduino device I am using) is not working anymore?

Best,
Ilayda

Source Audio's icon

max patch is not ok, arduino code is not ok

this is all it needs in arduino:

void setup() {Serial.begin(9600);}
void loop() { int xxx = Serial.Read();
if (xxx == 'A') {digitalWrite(13, HIGH);}
if (xxx == 'B') {digitalWrite(13, LOW);}}

in Max send A or B to turn motor on or off.
serial object sends ascii code.
you need atoi for that

You are better off using letters A & B than trying to parse ints in arduino.

you can use
if $f1 > 0. then A else B
insert zl change to avoid repetitions

that would at least allow max to control motor.
the other part - that whatever detector - is up to you to make it work

P.S.
don't forget - only one app can use serial port at same time !

Source Audio's icon

You are sending from Max to arduino to turn motor on or off.

What is that for :
Serial.println(xxx); ???

Print to what and why ?


and why do you add all this define pins etc giberish ?


#define vibOutPin 13
#define value
int motorPin = 13;
int xxx;


A teacher told you to do so ?

code i posted needs nothing else to do what you asked for
copy it, paste it into EMPTY sketch, upload, and that's it