Need help!!!

Hi to all

i am new in the area i got arduino uno and a relay.

i want to make a program to do simple thing. analog A0 = input will active my pin 10(connected to relay module) for 10 sec and return back to default stat. analog A1 = input will active my pin 11( connected to relay module) for 10 sec return back to default stat..

to the analog A0 & A1 i will connect a Button, so every press will activate the relay for 10 sec....

i got something like this

int pin = 13;

void setup() { pinMode(13, OUTPUT); digitalWrite(pin, HIGH); delay(10 * 1000); digitalWrite(pin, LOW); }

please i need help in that its urgent for me

thanks

You need to read the state of the A0 and A1 pins, but first you need to make them digital inputs with a "pinMode" and you also want to enable their pullup resistors.

When is our assignment due?

Please use code tags when posting code.

to the analog A0 & A1 i will connect a Button, so every press will activate the relay for 10 sec....

Why would you connect a digital device (off or on) to an analog pin?

PaulS: Why would you connect a digital device (off or on) to an analog pin?

I agree. Only use analog input pins for digital inputs when you have used up all the digital inputs.

...R

ycoms: please i need help in that its urgent for me

Have you tried any of the examples that come with the IDE? There are a number of helpful examples including one called 'Button'.

From what you've posted you should be able to modify 'Button' to do what you want (since you know how to turn the relay on for 10 seconds, just add that code to the example).

If nothing else that should get you a bit closer than you are right now.

Regards,

Brad KF7FER

Perhaps you should start from the beginning and read some of the good tutorials on this site here:

http://arduino.cc/en/Tutorial/HomePage

For your input-switch you can find an extra example like this:

http://arduino.cc/en/Tutorial/DigitalReadSerial

Go on learning step by step and dont try to do 2 or 3 steps at one time in the beginning...

good luck!

Hi

Re: Need help!!!

What with? Go back and edit your thread subject to tell us what you want help with, that way many more forum members might be encouraged to read your plea.

Help please.."Button press to activate relay."

Might be a start.

Tom.... :)