Académique Documents
Professionnel Documents
Culture Documents
1
Hairless MIDI must be inactive. Disable Serial<->MIDI Bridge On to upload
2
If you USB port is shutting down it is due to excess current demand. In that case your
joystick will need a current limiting resistor on the +5v line.
Example code:
int joyPin1 = 0; // slider variable connected to analog pin 0
int joyPin2 = 1; // slider variable connected to analog pin 1
int value = 0; // variable to read the value from analog pin
char note1, note2, noteprev;
void setup() {
Serial.begin(9600); // set the Baud rate
}
void loop() {
value = analogRead(joyPin1);
noteprev=note1;
note1= (value)/8; //10 bit to 7 bit
if (noteprev!=note1) // transmit data only if value has changed
{
Serial.write(176); //controller on channel 1: 1011-0000
Serial.write(10); //'Effect Control 1': 0-0000111
Serial.write(note1);
}
delay(20); //20ms delay to prevent false pot. readings
value = analogRead(joyPin2);
noteprev=note2;
note2= (value)/8; //10 bit to 7 bit
if (noteprev!=note2)
{
Serial.write(176); //controller on channel 1: 1011-0000
Serial.write(7); //'Effect Control 2': 0-0001011
Serial.write(note2);
}
delay(20); //20ms delay
}
Binary to Decimal conversion
MIDI Channel
no. bin. dec.
1 10110000 176
2 10110001 177
3 10110010 178
4 10110011 179
5 10110100 180
6 10110101 181
7 10110110 182
8 10110111 183
9 10111000 184
10 10111001 185
11 10111010 186
12 10111011 187
13 10111100 188
14 10111101 189
15 10111110 190
16 10111111 191
CC Number
bin. no. / dec. name.
00000001 1 modulation
00000101 5 portamento time
00000111 7 volume
00001111 10 pan
00010100 20 undefined (up to CC31)3
01000000 64 sustain
01000001 65 portamento on/off
01010100 84 portamento amount
01011011 91 reverb amount
01011100 92 tremelo amount
01011101 93 chorus amount
3
Undefined CC numbers:
3
9
14-15
20-31
85-90
102-119