Hi all
I'm working on a music midi project using Teensy 3.2. I have 22 sensors, 16 of which are monitored by pin A1 using a 16 channel Multiplexer and the remaining sensors using the ADC channels on the Teensy board. Everything works, but it seems that the sampling is just not quick enough to measure all the sensors quick enough for the speed of my fingers. For example 1/32 note at tempo 180, there are missed notes. I've been looking at Pedvides ADC Library and this seems to be the key, as I am currently just using analogRead... However, there doesn't seem to be much information on how to use the library. Can anyone offer me a road map on how to use this library. Also, I have attached a snippet from my code and I would be most grateful if any of you more experienced programmers could offer me some support.
Thank you in advance.
Ged.
I'm working on a music midi project using Teensy 3.2. I have 22 sensors, 16 of which are monitored by pin A1 using a 16 channel Multiplexer and the remaining sensors using the ADC channels on the Teensy board. Everything works, but it seems that the sampling is just not quick enough to measure all the sensors quick enough for the speed of my fingers. For example 1/32 note at tempo 180, there are missed notes. I've been looking at Pedvides ADC Library and this seems to be the key, as I am currently just using analogRead... However, there doesn't seem to be much information on how to use the library. Can anyone offer me a road map on how to use this library. Also, I have attached a snippet from my code and I would be most grateful if any of you more experienced programmers could offer me some support.
Thank you in advance.
Ged.
Code:
//---------------------------------------------------------------------------//
void readSwitches() {
//First read value of all Key Sensors
digitalWrite(4, LOW); //S0 //Sample from MUX 1
digitalWrite(3, LOW); //S1 //0000
digitalWrite(1, LOW); //S2
digitalWrite(0, LOW); //S3
U11 = analogRead(A1); //Samples through MUX_I0 channel
digitalWrite(4, HIGH); //S0 //0001
digitalWrite(3, LOW); //S1
digitalWrite(1, LOW); //S2
digitalWrite(0, LOW); //S3
U10 = analogRead(A1); //Samples through MUX_I1 channel
digitalWrite(4, LOW); //S0 //0010
digitalWrite(3, HIGH); //S1
digitalWrite(1, LOW); //S2
digitalWrite(0, LOW); //S3
U8 = analogRead(A1); //Samples through MUX_I2 channel
digitalWrite(4, HIGH); //S0 //0011
digitalWrite(3, HIGH); //S1
digitalWrite(1, LOW); //S2
digitalWrite(0, LOW); //S3
U9 = analogRead(A1); //Samples through MUX_I3 channel
digitalWrite(4, LOW); //S0 //0100
digitalWrite(3, LOW); //S1
digitalWrite(1, HIGH); //S2
digitalWrite(0, LOW); //S3
U4 = analogRead(A1); //Samples through MUX_I4 channel
digitalWrite(4, HIGH); //S0 //0101
digitalWrite(3, LOW); //S1
digitalWrite(1, HIGH); //S2
digitalWrite(0, LOW); //S3
U5 = analogRead(A1); //Samples through MUX_I5 channel
digitalWrite(4, LOW); //S0 //0110
digitalWrite(3, HIGH); //S1
digitalWrite(1, HIGH); //S2
digitalWrite(0, LOW); //S3
U12 = analogRead(A1); //Samples through MUX_I6 channel
digitalWrite(4, HIGH); //S0 //0111
digitalWrite(3, HIGH); //S1
digitalWrite(1, HIGH); //S2
digitalWrite(0, LOW); //S3
U13 = analogRead(A1); //Samples through MUX_I7 channel
digitalWrite(4, LOW); //S0 //1000
digitalWrite(3, LOW); //S1
digitalWrite(1, LOW); //S2
digitalWrite(0, HIGH); //S3
U3 = analogRead(A1); //Samples through MUX_I8 channel
digitalWrite(4, HIGH); //S0 //1001
digitalWrite(3, LOW); //S1
digitalWrite(1, LOW); //S2
digitalWrite(0, HIGH); //S3
U2 = analogRead(A1); //Samples through MUX_I9 channel
digitalWrite(4, LOW); //S0 //1010
digitalWrite(3, HIGH); //S1
digitalWrite(1, LOW); //S2
digitalWrite(0, HIGH); //S3
U1 = analogRead(A1); //Samples through MUX_I10 channel
digitalWrite(4, HIGH); //S0 //1011
digitalWrite(3, HIGH); //S1
digitalWrite(1, LOW); //S2
digitalWrite(0, HIGH); //S3
U14 = analogRead(A1); //Samples through MUX_I11 channel
digitalWrite(4, LOW); //S0 //1100
digitalWrite(3, LOW); //S1
digitalWrite(1, HIGH); //S2
digitalWrite(0, HIGH); //S3
U16 = analogRead(A1); //Samples through MUX_I12 channel
digitalWrite(4, HIGH); //S0 //1101
digitalWrite(3, LOW); //S1
digitalWrite(1, HIGH); //S2
digitalWrite(0, HIGH); //S3
U15 = analogRead(A1); //Samples through MUX_I13 channel
digitalWrite(4, LOW); //S0 //1110
digitalWrite(3, HIGH); //S1
digitalWrite(1, HIGH); //S2
digitalWrite(0, HIGH); //S3
U7 = analogRead(A1); //Samples through MUX_I14 channel
digitalWrite(4, HIGH); //S0 //1111
digitalWrite(3, HIGH); //S1
digitalWrite(1, HIGH); //S2
digitalWrite(0, HIGH); //S3
U6 = analogRead(A1); //Samples through MUX_I15 channel
U17 = analogRead(A2);
U18 = analogRead(A3);
U19 = analogRead(A4);
U20 = analogRead(A5);
U21 = analogRead(A6);
U22 = analogRead(A7);
Last edited: