ArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArray
Statistics: Posted by headphoner — 01 Mar 2009, 11:48
Statistics: Posted by senso — 28 Feb 2009, 09:51
Statistics: Posted by Clearscreen — 28 Feb 2009, 06:15
Statistics: Posted by senso — 27 Feb 2009, 00:18
Statistics: Posted by Clearscreen — 27 Feb 2009, 00:05
Statistics: Posted by antwan — 26 Feb 2009, 20:53
Statistics: Posted by antwan — 26 Feb 2009, 20:04
Statistics: Posted by senso — 26 Feb 2009, 11:57
Statistics: Posted by Clearscreen — 26 Feb 2009, 11:09
Statistics: Posted by senso — 26 Feb 2009, 09:13
Statistics: Posted by antwan — 09 Feb 2009, 21:45
Statistics: Posted by headphoner — 09 Feb 2009, 19:34
Statistics: Posted by antwan — 21 Dec 2007, 09:15
Statistics: Posted by senso — 21 Dec 2007, 08:58
Statistics: Posted by Clearscreen — 20 Dec 2007, 22:53
CODE:
int buttonA = 2; // Pin button is connected to// Key de-bouncing stuffint lastKey = 0;long time = 0;int debounce = 100;// minimum allowed time between button pressesvoid setup() // run once, when the sketch starts{ pinMode(buttonA, INPUT); // sets the digital pin as input digitalWrite(buttonA, HIGH); // Pull high Serial.begin(9600); // Start serial output}void loop() // run over and over again{ if ((digitalRead(buttonA) == LOW) && (millis() - time > debounce) && lastKey != 1) { noteOn(9,56,120); // channel 9 - maps to MIDI channel 10 AKA percussion) // note 56 - Cow Bell! // velocity 120 (127 = max) time = millis();// Reset debounce clock lastKey = 1; // Store last button state } else if ((digitalRead(buttonA) == HIGH) && lastKey == 1) lastKey = 0;}// Send a MIDI note-on messagevoid noteOn(byte channel, byte note, byte velocity) { midiMsg(channel+0x90, note, velocity);}// Send a MIDI control changevoid controlChange(byte channel, byte controller, byte value) { midiMsg(channel+0xB0, controller, value);}// Send a general MIDI messagevoid midiMsg(byte cmd, byte data1, byte data2) { Serial.print(cmd, BYTE); Serial.print(data1, BYTE); Serial.print(data2, BYTE);}Statistics: Posted by antwan — 20 Dec 2007, 13:54
Statistics: Posted by senso — 18 Dec 2007, 20:23
CODE:
/* * Arduino2Max * Send pin values from Arduino to MAX/MSP * * Arduino2Max.pde * ------------ * This version: .4, October 2007 * ------------ * 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 valuesint 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); }Statistics: Posted by antwan — 18 Dec 2007, 08:32
Statistics: Posted by antwan — 13 Dec 2007, 15:54
Statistics: Posted by headphoner — 01 Mar 2009, 11:48
Statistics: Posted by senso — 28 Feb 2009, 09:51
Statistics: Posted by Clearscreen — 28 Feb 2009, 06:15
Statistics: Posted by senso — 27 Feb 2009, 00:18
Statistics: Posted by Clearscreen — 27 Feb 2009, 00:05
Statistics: Posted by antwan — 26 Feb 2009, 20:53
Statistics: Posted by antwan — 26 Feb 2009, 20:04
Statistics: Posted by senso — 26 Feb 2009, 11:57
Statistics: Posted by Clearscreen — 26 Feb 2009, 11:09
Statistics: Posted by senso — 26 Feb 2009, 09:13
Statistics: Posted by antwan — 09 Feb 2009, 21:45
Statistics: Posted by headphoner — 09 Feb 2009, 19:34
Statistics: Posted by antwan — 21 Dec 2007, 09:15
Statistics: Posted by senso — 21 Dec 2007, 08:58
Statistics: Posted by Clearscreen — 20 Dec 2007, 22:53
CODE:
int buttonA = 2; // Pin button is connected to// Key de-bouncing stuffint lastKey = 0;long time = 0;int debounce = 100;// minimum allowed time between button pressesvoid setup() // run once, when the sketch starts{ pinMode(buttonA, INPUT); // sets the digital pin as input digitalWrite(buttonA, HIGH); // Pull high Serial.begin(9600); // Start serial output}void loop() // run over and over again{ if ((digitalRead(buttonA) == LOW) && (millis() - time > debounce) && lastKey != 1) { noteOn(9,56,120); // channel 9 - maps to MIDI channel 10 AKA percussion) // note 56 - Cow Bell! // velocity 120 (127 = max) time = millis();// Reset debounce clock lastKey = 1; // Store last button state } else if ((digitalRead(buttonA) == HIGH) && lastKey == 1) lastKey = 0;}// Send a MIDI note-on messagevoid noteOn(byte channel, byte note, byte velocity) { midiMsg(channel+0x90, note, velocity);}// Send a MIDI control changevoid controlChange(byte channel, byte controller, byte value) { midiMsg(channel+0xB0, controller, value);}// Send a general MIDI messagevoid midiMsg(byte cmd, byte data1, byte data2) { Serial.print(cmd, BYTE); Serial.print(data1, BYTE); Serial.print(data2, BYTE);}Statistics: Posted by antwan — 20 Dec 2007, 13:54
Statistics: Posted by senso — 18 Dec 2007, 20:23
CODE:
/* * Arduino2Max * Send pin values from Arduino to MAX/MSP * * Arduino2Max.pde * ------------ * This version: .4, October 2007 * ------------ * 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 valuesint 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); }Statistics: Posted by antwan — 18 Dec 2007, 08:32
Statistics: Posted by antwan — 13 Dec 2007, 15:54