Timeline for Rasberry Pi Controlling Arduino - Reads "Ghost" Input - Doesn't Complete Logic Loop
Current License: CC BY-SA 4.0
19 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 23, 2020 at 18:29 | comment | added | StarCat | I've made my comment into an answer. Good luck with your project! | |
Dec 23, 2020 at 18:29 | vote | accept | GeorgeWTrump | ||
Dec 23, 2020 at 18:28 | answer | added | StarCat | timeline score: 1 | |
Dec 23, 2020 at 18:20 | comment | added | GeorgeWTrump | @StarCat Thanks! It works great now! If you want to, you can post your comment as an answer and I will accept it. | |
Dec 23, 2020 at 17:15 | history | edited | ocrdu | CC BY-SA 4.0 |
Formatted code, added tag.
|
Dec 23, 2020 at 16:02 | comment | added | StarCat | See here The resistor needs to be between the button input pin and ground to give it a defined value when the button is released. The resistor to ground will make sure the pin reads "low" when no button is pressed. When the button is pressed, it will be connected directly to +5V and will read high. Only a small current (0.5mA) will flow from +5V to ground through the 10K Ohm resistor in that case. It will not create a short circuit. | |
Dec 23, 2020 at 15:55 | comment | added | GeorgeWTrump | @StarCat If I connect the button to ground won't it create a short circuit? How do you mean connect 10K ohms between pin 49 and ground? | |
Dec 23, 2020 at 15:54 | history | edited | GeorgeWTrump | CC BY-SA 4.0 |
added 38 characters in body
|
Dec 23, 2020 at 15:53 | comment | added | StarCat |
There's also nothing to pull the button output to LOW when the button is released so it is very vulnerable to noise. You should put a pulldown resistor of around 10K Ohms between pin 49 and ground to make the button more reliable.
|
|
Dec 23, 2020 at 15:51 | comment | added | StarCat |
You set the motorOutput to HIGH when you detect that the button is pressed, bu you do not set it to LOW again when it is released. So it stays HIGH .
|
|
Dec 23, 2020 at 15:40 | history | edited | GeorgeWTrump | CC BY-SA 4.0 |
added 60 characters in body
|
Dec 23, 2020 at 14:39 | answer | added | Andrew | timeline score: 1 | |
Dec 23, 2020 at 14:15 | comment | added | GeorgeWTrump | @StarCat4 Wouldn't it change once the button reads nothing? | |
Dec 23, 2020 at 14:15 | comment | added | GeorgeWTrump | Alright, I have added the schematics now. | |
Dec 23, 2020 at 14:14 | history | edited | GeorgeWTrump | CC BY-SA 4.0 |
added 120 characters in body
|
Dec 23, 2020 at 11:29 | comment | added | Majenko | Please show your wiring. You say the wiring is not bad, but we'll be the judge of that, not you. | |
Dec 23, 2020 at 9:38 | comment | added | StarCat | I strongly suspect a hardware issue. How are you providing power to the Mega2560 and the motor? How are you controlling the motor and how is the button wired (pulldown)? You are aware that, with the code you've shown, once you activate the motor output, it will never turn off? | |
Dec 23, 2020 at 2:55 | comment | added | jsotola |
checked, the motor and the button is wired correctly ... how do you know?
|
|
Dec 22, 2020 at 23:11 | history | asked | GeorgeWTrump | CC BY-SA 4.0 |