Offline
Newbie
Karma: 0
Posts: 16
|
 |
« on: March 30, 2012, 03:52:17 am » |
hi How to connect analog sensors sharp GP2Y0A21YK+ arduino uno + MaxMSP ?
|
|
|
|
|
Logged
|
|
|
|
|
Gosport, UK
Offline
Faraday Member
Karma: 19
Posts: 3117
|
 |
« Reply #1 on: March 30, 2012, 04:05:57 am » |
Some wires between the sensor and the Arduino, and a USB cable from the Arduino to the PC.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 16
|
 |
« Reply #2 on: March 30, 2012, 06:40:08 am » |
which can I use the example in arduino software ? ( for max test analog freq ) and Is there a sample max msp patch ?
|
|
|
|
|
Logged
|
|
|
|
|
Gosport, UK
Offline
Faraday Member
Karma: 19
Posts: 3117
|
 |
« Reply #3 on: March 30, 2012, 06:50:56 am » |
I don't know. Where have you looked? Did you try searching this site? Did you try google or bing or whatever search site you use? Try here http://arduino.cc/playground/Interfacing/MaxMSP for a start.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 16
|
 |
« Reply #4 on: March 30, 2012, 07:18:52 am » |
i downloaded arduino 2 max but Error adding cod is pde on arduino software ( serial BYTE ) http://f1203.hizliresim.com/v/y/3y3qb.png
|
|
|
|
|
Logged
|
|
|
|
|
Gosport, UK
Offline
Faraday Member
Karma: 19
Posts: 3117
|
 |
« Reply #5 on: March 30, 2012, 07:32:13 am » |
The error message is quite descriptive. Find the Serial.print() statement containing the BYTE keyword and replace it with a Serial.write() instead.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 16
|
 |
« Reply #6 on: March 30, 2012, 07:41:17 am » |
how can i Find the my Serial.print() ? sorry i beginner user
|
|
|
|
|
Logged
|
|
|
|
|
Gosport, UK
Offline
Faraday Member
Karma: 19
Posts: 3117
|
 |
« Reply #7 on: March 30, 2012, 07:48:01 am » |
You could try Edit>Find... in the IDE, or you could just look for it.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 16
|
 |
« Reply #8 on: March 30, 2012, 07:58:57 am » |
my arduino max pde :
/* * Arduino2Max * Send pin values from Arduino to MAX/MSP * * Arduino2Max.pde * ------------ * This version: .5, November 29, 2010 * ------------ * Copyleft: use as you like * by Daniel Jolliffe * Based on a sketch and patch by Thomas Ouellet Fredericks tof.danslchamp.org * */
int x = 0; // a place to hold pin values int ledpin = 13;
void setup() { Serial.begin(115200); // 115200 is the default Arduino Bluetooth speed digitalWrite(13,HIGH); ///startup blink delay(600); digitalWrite(13,LOW); pinMode(13,INPUT); }
void loop() {
if (Serial.available() > 0){ // Check serial buffer for characters if (Serial.read() == 'r') { // If an 'r' is received then read the pins for (int pin= 0; pin<=5; pin++){ // Read and send analog pins 0-5 x = analogRead(pin); sendValue (x); }
for (int pin= 2; pin<=13; pin++){ // Read and send digital pins 2-13 x = digitalRead(pin); sendValue (x); } Serial.println(); // Send a carriage returnt to mark end of pin data. delay (5); // add a delay to prevent crashing/overloading of the serial port }
} }
void sendValue (int x){ // function to send the pin value followed by a "space". Serial.print(x); Serial.print(32, BYTE); }
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 16
|
 |
« Reply #9 on: March 30, 2012, 08:03:27 am » |
please can you put them cod and save give me please cod ? because i don't find I do not know what to do thanks
|
|
|
|
|
Logged
|
|
|
|
|
Gosport, UK
Offline
Faraday Member
Karma: 19
Posts: 3117
|
 |
« Reply #10 on: March 30, 2012, 08:35:34 am » |
There is one occurrence of a Serial.print() with the BYTE keyword in it. Replace it with Serial.write(32);
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 16
|
 |
« Reply #11 on: March 30, 2012, 08:43:15 am » |
ok done compling thanks, but after clicked I run max msp and (Arduino2MaxNovember2010_V.5) patch. toggle click COM 2 how can i do that now because my sensor is does not eork right now ? 
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 16
|
 |
« Reply #12 on: March 30, 2012, 09:15:24 am » |
i changed com 2 to bluethoot pda sync and analog input ra0 ra1 ra2 ra3 ra4 ra5 its is work very fast number changes. is it connect arduino to max ? ( my sensor put on the ardunio analog signal A1 )
|
|
|
|
|
Logged
|
|
|
|
|
Gosport, UK
Offline
Faraday Member
Karma: 19
Posts: 3117
|
 |
« Reply #13 on: March 30, 2012, 09:20:10 am » |
Does your Arduino have Bluetooth?
I don't know anything about Max.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 16
|
 |
« Reply #14 on: March 30, 2012, 09:31:13 am » |
No, i connect COM 2
|
|
|
|
|
Logged
|
|
|
|
|
|