Go Down

Topic: Quick suggestion on approaching this problem (Read 2 times) previous topic - next topic

FullyJosh




That's the problem then. There is no way that a serial port sending ASCII codes can convey information about how long a key was pressed. I think a Leonardo could do it, because I believe it can emulate a USB PC keyboard, for which the up- and down-codes are sent separately.


Problem with that is that the Leonardo doesn't have enough analog pins.

Do you know how I can fix the issue where your code works flawlessly in the serial monitor but starts glitching when I turn on aac keys?


Not without using a Leonardo or other device that can emulate a keyboard that returns scan codes. How many analog inputs do you need, and why? The Leonardo has 12, and you can add more using an external ADC or analog multiplexer.



That's the problem then. There is no way that a serial port sending ASCII codes can convey information about how long a key was pressed. I think a Leonardo could do it, because I believe it can emulate a USB PC keyboard, for which the up- and down-codes are sent separately.


Problem with that is that the Leonardo doesn't have enough analog pins.

Do you know how I can fix the issue where your code works flawlessly in the serial monitor but starts glitching when I turn on aac keys?


Not without using a Leonardo or other device that can emulate a keyboard that returns scan codes. How many analog inputs do you need, and why? The Leonardo has 12, and you can add more using an external ADC or analog multiplexer.


I'm just wondering because it has that same issue when using it to print the letter a in a word document. 

I need 13 analog pins.  I want to go one full octave from c to c

dc42

Why are you using analog pins, when it looks to me that you only need to detect whether a note is pressed or not?
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

FullyJosh


Why are you using analog pins, when it looks to me that you only need to detect whether a note is pressed or not?


I initially tried using the digital route and was noticing it was rather unstable.

But you are correct all I need to detect is on or off

dc42

#33
Jan 05, 2013, 01:12 am Last Edit: Jan 05, 2013, 01:19 am by dc42 Reason: 1
Given that your threshold was 830 out of 1024 and you register a key press if the value is above threshold, I deduce that you are using pulldown pullup resistors, and that to use digital inputs, you need to decrease increase their value by a factor of about 4. If the Arduino by itself doesn't give good results using digital inputs, you could pass the signals through 74HC14 hex inverters first.

btw I've never used a Leonardo, but I understand that it can emulate a PC keyboard via the USB port.

[EDIT: corrected the above, on the assumption that interrupting a light beam causes a note to sound.]
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Go Up