I have an Arduino Micro which I have programmed to translate a 5v pulse on digital 2 into a keystroke. The program is very simple, and functions flawlessly on both of my laptops, but when I plug it into the computer that I designed it for the pin is constantly high and the keystroke repeats (every 200ms, the delay that I set it to.)
Please post it here
Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'
Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination
How is the input wired ?
How are you interfacing the arduino board with the keyboard or the computer? A wild guess but the computer/keyboard with trouble probably needs a pull-down resistor at its output (pin?), or it should not be floating or open-collector. If this is high then the arduino board will faithfully take that as a valid input.
That's a good guess, but I do have a pulldown resistor in the circuit. Like I said, the setup works on my other two computers. I suspect that this is a windows driver issue, because the device works when it is plugged into any other computer.
The arduino board is connected to the computer with USB, right? If so then connect a small LED reading lamp to the USB ports of all the computers with all of them shut down - remove the AC mains as well. Check if lamp behaves differently between the three (i.e., turn on). Depending on motherboard and/or OS the port might be remaining powered even if shut down. Also, some configurations keep devices connected to the USB ports enabled (not just powered) as well. This might give some clues...
Positive pin d2, grounded to ground, pulldown resistor from pin d2 to ground
I initially tested the circuit with a push button and a power supply, then hooked it up to a credit card reader. Both work perfectly on not of my laptops (old Samsung with Ubuntu and a new Lenovo with Windows 10) when I plugged it into the computer that I actually need it to run, (A Lenovo mini desktop) it is behaving the way I described.
The sketch was honestly too simple for me to even bother saving. I can rewrite and reflash (to make sure it's identical) if you think that it's important to post it here.
In the meantime I'm going to start checking pins with a multimeter as soon as I get to my office.
You want to use it on the Lenovo desktop with windows....and this one is having trouble? The other two are Linux flavours, right?
I want to use it with the Lenovo desktop with Windows 10. One of my laptops is running Linux the other is running Windows 10. It works on both of the laptops. Windows 10 and Ubuntu.
Ok. Since it works on both laptops irrespective of OS then perhaps checking the USB settings on the desktop both at the OS level and BIOS might help...? Maybe you could compare the OS level settings between the windows laptop and the desktop to see if there's any difference...?
USB settings are somewhat tricky especially with windows. My old Toshiba does not have any BIOS level setting to turn off USB ports upon shutdown. And in Windows 7 there is no way to power down the ports at shutdown (even after explicitly setting it) - so both its USB ports have power with the laptop shut down and the power adaptor disconnected.
I feel its not a driver problem if USB devices such as mouse or keyboard connected to the lenovo desktop work normally.
I agree now that I have an oscilloscope on it. I put the leads between pin 2 and ground and the difference between the laptops and the desktop is very obvious.
For some reason when I plug into the desktop I am getting random "noise" between pin 1 and ground between +0.48v and -0.75v.
Would that be enough to trigger a high state on digital read?
One of the other USB peripherals on the desktop was feeding back and generating enough noise on the bus to disrupt the Arduino Micro.
Thank you for your help.
Welcome. Glad to help!