I have a shield, that I mentioned in a different thread. I have a button on IO pin 39, which if I watch with Logic Analyzer is pulled down to zero when I press the button. However my code is not detecting it. I will double check it again with Analyzer, but here is a simple test case:
I am not sure yet about other IO pins. I do have buttons on 2 other IO ins 41 and 43, but found I was short on parts. Order with those should arrive next day or so.
I do have a 10K PU resistor connected to IOREF voltage and the IO line side of the button. The other side of button connected to ground. I have also tried with configuring the pin as INPUT_PULLUP, no difference.
So far it is looking to me like I am not getting input on any of the IO pins. I tried removing the shield and the like and use a jumper wire, I tried, for example looping from IO pins 2-12 doing a digitalInput and print out a message if it goes low. I used pinMode(i, INPUT_PULLUP); on these pins. Did not get any inputs that worked here...
Suggestions? Is my due screwed up? I believe I tested some yesterday or the day before to show that I could do output to these pins.
Does the Blink example work properly?
What is the output of DigitalReadSerial with a wire between pin 2 and GND?
What is the output of DigitalReadSerial with a wire between pin 2 and 3.3V?
In DigitalReadSerial, change the line int pushButton = 2; to int pushButton = 39;
What is the output of the modified DigitalReadSerial with a wire between pin 39 and GND?
What is the output of the modified DigitalReadSerial with a wire between pin 39 and 3.3V?
Actually that appears to be working? So need to reduce the other stuff to see what is going on. The actual sketch I was using, was working on other Arduinos... but maybe something else interfering.
I am still sort-of scratching my head on this one.
As I mentioned DigitalReadSerial does work on this IO pin when my shield is not in place, but not when I have may shield plugged in.
So this implies something with my shield.
On the shield I have the button connected up to this IO line with a 10K resistor attached to IOREF. The other side of the button is connected to ground. I have used both a Logic Analyzer and volt meter to verify that when the button is not pressed, I have 3.3v at the IO pin (shows as 1 on LA). When I press the button I get 0 volts (shows up as 0 on LA), but digitalRead always retuns a non zero value(1). Could it be other things on the same IO port interfering?
I have Leds on: 38, 40, 42 - that all appear to be working
I have buttons on 39, 41, 43 - that are not working.
I have a speaker circuit on 44
To verify that my shield pins were making contact, I ran my digital output test and connected up LA to the IO pins that the buttons are connected and was able to verify that I could actually drive these IO pins from the DUE...
Also side note: fixed an issue with my shield where some IO pins were not being fed 3.3v but instead were floating. With this I can now properly connect up to my Playstation 2 controller code, which is connected on IO pins 46-49.
I hope there is a suitable resistor and capacitor in there.
What is this DigitalReadSerial command? Why are you not doing it properly? Could you post the code so I could try it on my Due.
Hi, actually DigitalReadSerial is not a command but is a sketch, that is under the Examples 01.digital menu
The speaker is hooked up through a 4.66k resistor connected up to a transistor, that then feeds speaker. The other side of speaker has +5v going through a 50ohm resistor and, there is a diode... There is a schematic of an earlier version of this shield up on my thread at: http://www.lynxmotion.net/viewtopic.php?f=26&t=8021
I am including a zip file created of my main test program. It is not great, but does allow me to check out different things of my shield. There are hacks in place as not everything is ported. Also it has a PS2 (playstation 2 test), that relies on a PS2 library, which I think I have working port of it. It is up on my github account github\kurte
I am trying a couple of different things to see if it works. Like I took an unpopulated shield, put it over the DUE and use some spare stackable headers, which I know won't make great contact... I then put in the three buttons, again no solder. I tried the digitalReadSerail sketch and at least 2 of these worked then. So on my populated version I have removed the PU resistors to see if that helps... Nope...
I am pretty sure now, that the stackable headers are not making good contact in some areas of the back row of contacts.
They appear to be fully in, but I was able to get 43 to work after pressing boards together with clamp... Not something I would like to do... If the contacts are not all the way down, the main thing that hits first is the power connection on the DUE... Maybe if I make a new version of this board to fix my other problem, I should remove that region of my shield... Also wonder if maybe there are better stackable headers that make better contact?
Not sure if I will do that or not. I can probably simply wire jumper from those buttons to some other IO pins if I need to use the buttons.