DELAY TIME QUESTIONS?

Please could you help me about the delay time?

I need to run once and then waiting for one hour. but every 3 minutes the port 5 go high.

int sw34 = 5; const long oneSecond = 1000; const long oneMinute = oneSecond * 60; const long oneHour = oneMinute * 60;

// the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(sw34, OUTPUT);

// the loop routine runs over and over again forever:

digitalWrite(sw34, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(sw34, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second

} void loop() { delay (oneHour); }

Setup is only called once after power on or reset as you say. If you want something to happen every hour you need to put code in your loop function. Is that all the code you have? If so I cannot see why it would trigger at all and certainly not every 3 minutes.

That code should set the pin HIGH once, for one second. After that, it should set the pin LOW, and never do another useful thing.

loop() will be called again an hour later, but again do nothing.

You could (and should) add Serial.begin() to setup() and Serial.print() statements to setup() and loop(), to confirm that loop only gets called once an hour.

Dears friends!

that's it, but every time that a run the code I'm sure, the Port 5 go to high less than 3 minutes. Every time, I think that's about WDGT or some reset.

I try this one.

int sw34 = 5;

// the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(sw34, OUTPUT);

// the loop routine runs over and over again forever:

digitalWrite(sw34, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(sw34, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second

} void loop() { }

but I have the same problem.....this is some kind behavior

thanks

I'll put the serial print to see what happening.

Dear friends!

When I remove the circuit works!

wow - I means, I have the BC548 connected in the Pin 5 with resitors that 30kohms in base.

It's possible some current go back and made this behavior?

int sw34 = 13;

// the setup routine runs once when you press reset: void setup() {

Serial.begin(9600); // initialize the digital pin as an output. pinMode(sw34, OUTPUT);

// the loop routine runs over and over again forever:

digitalWrite(sw34, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second Serial.println(sw34); digitalWrite(sw34, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second Serial.println(sw34); } void loop() { }

DEAR FRIENDS,

BELIEVE OR NOT the problem was the USB cable. If I try to use external power supply the software OK.

If I try to run with USB in the computer the Arduino always reset.

I don't know why, any opnion? but now is ok!

If I try to run with USB in the computer the Arduino always reset.

I don't know why, any opnion?

It would be useful to know what a BC548. If that draws too much current, the USB port on the computer may be dropping power to the Arduino, causing a reset.