HIGH AND LOW RANDOMLY CHANGING

I have the internal pull turn on, but value keep changing 1100,0101,1110,0111 etc.
I am a newbie at this, any help will be appreciated.

When I tested your sketch that did not happen:

Motor test!
idle
1
1
1
1
idle
1
1
1
1
idle
1
1
1
1
idle
1
1
1
1
idle
1
1
1
1
idle
1
1
1
1
idle
1
1
1
1

I just recheck it only happen when i add power to the motor and relay.
What else could be the cause this problem.

Noise?

How are you powering all this? What is the motor connected to? Wiring diagram perhaps?

[quote author=Nick Gammon link=topic=272691.msg1921520#msg1921520 date=1413338278]
How are you powering all this? What is the motor connected to? Wiring diagram perhaps?
[/quote]I think I can guess :wink:

Edit: But I'd be wrong. Sorry.

I am using a pc power supply

Rather than using the internal pull-ups try something stronger, like 1k resistors.

I don't have any 1 k will try tomorrow.
would you recommended using a different power supply.

The internal pull-ups are around 50k. Something smaller than that would do. Even 10k would probably help. Or 4.7 k if you have them. Just try on one pin and see if that one stabilizes.

Don't go much below 500 ohms as that would draw too much current.

would you recommended using a different power supply.

Hard to say. Something is noisy but that is probably the motor.

i have 2.2k

Hi, I assume you have removed the sketch that Nick, tested. Please leave them in the post as it disjoints flow.

Can you post a picture of your project so we can see how you have it assembled, it will help if we have an idea of the layout of components.

Tom..... :slight_smile:

TomGeorge:
Hi, I assume you have removed the sketch that Nick, tested. Please leave them in the post as it disjoints flow.

I can't believe he did that! I copied and pasted it myself and had a look at it. It's not as if it gave away any trade secrets.

@forcecircuit: That's intensely annoying when you edit your original post to make the thread meaningless. Put it back please.

See: How to use this forum - please read - #2 by nickgammon - Website and Forum - Arduino Forum

It is disrespectful to change the contents of a thread like that. Correct spelling errors, sure. But don't remove what you asked about.

If you keep doing that you will be banned, we don't have time for this sort of behaviour.