Communication problem between Bluetooth Uno and Max MSP


hi there, have done fair amount of research can't seem find solution this, hope can help!

i have arduino uno taking sensor readings, , trying relay information through hc-06 bluetooth module through max msp. mac connecting hc-06 fine, , given option in max's list of serial ports. i'm using ever popular "arduino2max_nov2012" max patch , arduino code. readings 0 analogue , digital pins.

i have adjusted code match hc-06's baud rate of 9600 in arduino code, , in max patch serial object has been adjusted "serial 9600 8 1 0" instead of "serial 115200 8 1 0." here arduino code:

code: [select]
int x = 0;                              // place hold pin values
int ledpin = 13;

void setup()
{
  serial.begin(9600);               // 115200 default arduino bluetooth speed - changed 9600 here
  digitalwrite(13,high);              ///startup blink
  delay(600);
  digitalwrite(13,low);
  pinmode(13,input);
}



void loop()
{

if (serial.available() > 0){         // check serial buffer characters
       
    if (serial.read() == 'r') {       // if 'r' received read pins
   
for (int pin= 0; pin<=5; pin++){      // read , send analog pins 0-5
    x = analogread(pin);
    sendvalue (x);
    }



for (int pin= 2; pin<=13; pin++){     // read , send digital pins 2-13
    x = digitalread(pin);
    sendvalue (x);
    }
 
    serial.println();                 // send carriage returnt mark end of pin data.
    delay (5);                        // add delay prevent crashing/overloading of serial port
 
  }

}
}

void sendvalue (int x){              // function send pin value followed "space".
serial.print(x);
serial.write(32);
}



i have used same set-up (without baud rate changes) many times in past, i'm quite sure problem lies in bluetooth somewhere.
the hc-06 rx-tx tx-rx'd arduino, need specify arduino communicate on these pins, instead of through usb? think may issue.

i hope can me out! thanks.

quote
the hc-06 rx-tx tx-rx'd arduino, need specify arduino communicate on these pins, instead of through usb? think may issue.

on uno, "on rx , tx" , "through usb" mean same thing.


Arduino Forum > Using Arduino > Interfacing w/ Software on the Computer > Communication problem between Bluetooth Uno and Max MSP


arduino

Comments

Popular posts from this blog

VIDIOC_S_FMT error 16, Device or resource busy - Raspberry Pi Forums

using a laptop skeleton to build a pi laptop - Raspberry Pi Forums

Forum for Joomla? - Joomla! Forum - community, help and support