Hello,
I'm currently in the process of building an external controller with quite a few potentiometers and switches. I'm using a teensy 3.5 and have 22 potentiometers connected to analog pins and 11 switches connected to the digital pins all of which are to be read within MaxMSP. My problem is that while the pins on the board are being read and can be seen to be active within the serial monitor, they aren't responding at all when I actually turn a potentiometer or flick a switch. I'm using a sketch by Thomas Ouellet Fredericks that is specifically for arduino and MaxMSP communication (As shown below) and I previously tested this set up on a slightly smaller scale (8 potentiometers and a few switches) with a teensy 2.0 ++ board and everything worked absolutely fine. I was hoping that by changing the code slightly to suit the 3.5 board everything would be working as expected but that's not the case. Any help on this would be seriously appreciated, I'm a bit of an amateur and perhaps got ahead of myself but I'd really like to see this working!
- I'm confident the cable is good
- I'm certain all the wires are in their right places
- I've looked into reading the sensors twice but had no luck
- Along with the traffic/wild values everything appears to just stop after a few minutes
Code below:
/*
* 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= A0; pin<=A22; pin++){ // Read and send analog pins 0-21
x = analogRead(pin);
sendValue (x);
}
for (int pin= 0; pin<=10; pin++){ // Read and send digital pins 0-11
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.write(32);
}
I'm currently in the process of building an external controller with quite a few potentiometers and switches. I'm using a teensy 3.5 and have 22 potentiometers connected to analog pins and 11 switches connected to the digital pins all of which are to be read within MaxMSP. My problem is that while the pins on the board are being read and can be seen to be active within the serial monitor, they aren't responding at all when I actually turn a potentiometer or flick a switch. I'm using a sketch by Thomas Ouellet Fredericks that is specifically for arduino and MaxMSP communication (As shown below) and I previously tested this set up on a slightly smaller scale (8 potentiometers and a few switches) with a teensy 2.0 ++ board and everything worked absolutely fine. I was hoping that by changing the code slightly to suit the 3.5 board everything would be working as expected but that's not the case. Any help on this would be seriously appreciated, I'm a bit of an amateur and perhaps got ahead of myself but I'd really like to see this working!
- I'm confident the cable is good
- I'm certain all the wires are in their right places
- I've looked into reading the sensors twice but had no luck
- Along with the traffic/wild values everything appears to just stop after a few minutes
Code below:
/*
* 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= A0; pin<=A22; pin++){ // Read and send analog pins 0-21
x = analogRead(pin);
sendValue (x);
}
for (int pin= 0; pin<=10; pin++){ // Read and send digital pins 0-11
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.write(32);
}