Go Down

Topic: [ARDUINO UNO] - Interrupt only works while connect to USB (Read 775 times) previous topic - next topic

johnbox

Hey there,

i'm currently playing around with a little roboter I've made. What I'm currently trying to accomplish, is that when the roboter drives against a wall or something and pushes down a little button installed on the outer roboter-case, it's supposed to drive a little backwards, spin around and go forward again. To accomplish this, I've created an interrupt, which is triggered by a little red test-button. The function connected to the interrupt is farely simple: it simply sets Pin 6, 12 and 13 to HIGH. (6 - LED, 12&13 Motorshield Direction Pins)
This works pretty well so far, as long as the Arduino is connected to my PC. If i pull out the USB-cable, and press the button while the roboter is driving, it stops everything for 2 seconds.. and then goes on. The led which is supposed to get lighten in the interrupt function shortly lightens up, and goes out a millisecond after.

Any ideas?
Here's a video of it with me explaining it once again:
http://youtu.be/5Db5JdML4OM


Sincerely,
johnbox

Robin2

it stops everything for 2 seconds..
That sounds like it is causing the Arduino to reset - most likely because you do not have a suitable power supply.

Wild guess - you are using a PP3 type 9v battery? They can't produce enough current. Use AA NiMh batteries.

Also worth checking that the switch is wired correctly.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

MarkT

You need a reliable _separate_ supply for the Arduino from any motors/servos/motor drivers,
this is a common problem, people think they can get away with sharing supply between power
and logic components - you can't.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

johnbox

Oh well, thanks for clearing that up. I'm pretty new to this stuff and until I experienced above problems everything worked pretty fine - so I didn't think the power supply could suddenly become a problem :/

Thank you guys for helping me out !

Go Up