Latching Outputs.

Can anyone help me out with this?

I've been tryin' to latch the output of any digital pin of my board. But it won't work. After 20-25 seconds the built in led starts flashing and all outputs become low (may be code is bein rebooted??). After that the outputs become high again, as it demands the code.

I need to latch in HIGH one output to keep active a relay. I've tried also to use plcLib.h and set()&reset() and latch() functions. But it happens the same I described in first. I'm using UNO.

Has anyone else noticed that? Please, help.

Please supply your code. Unless your code commands the output to change state, it should remain in the set state.

Please put your code in its own window as seen in other posts. This can be done by placing     [code] and [/code]  around the code. This makes it easier for others to read.

Weedpharma

Please http://forum.arduino.cc/index.php/topic,148850.0.html

Why/how “latch” outputs? Do you mean to write to ports instead of individual pins?

Perhaps you’re overloading the output pins, heating the chip until it reboots.

If you are powering a relay coil directly from the arduino you may be causing the arduino to reboot due to low voltage.

Almost always caused by a lack of supply decoupling. Outputs will normally be latched, something is happening to to reset your processor. This is normally interference from a motor of some description.

However unless you tell us what you are doing we can not be more specific.

DrDiettrich: Why/how "latch" outputs? Do you mean to write to ports instead of individual pins?

Perhaps you're overloading the output pins, heating the chip until it reboots.

weedpharma: Please supply your code. Unless your code commands the output to change state, it should remain in the set state.

Please put your code in its own window as seen in other posts. This can be done by placing

[code] and [/code]

around the code. This makes it easier for others to read.

Weedpharma

This is the code. After 30 seconds(aprox), built in led starts flashing and x becomes low. After that, x turns high.

int x=7;
void setup(){
  pinMode(x,OUTPUT);
  digitalWrite(x,HIGH);
}
void loop(){
}

zoomkat: If you are powering a relay coil directly from the arduino you may be causing the arduino to reboot due to low voltage.

I'm not doin' that . I'm just trying to keep lightened a led. This is the code I'm using:

int x=7;
void setup(){
  pinMode(x,OUTPUT);
  digitalWrite(x,HIGH);
}
void loop(){
}

DrDiettrich: Why/how "latch" outputs? Do you mean to write to ports instead of individual pins?

Perhaps you're overloading the output pins, heating the chip until it reboots.

Dr Diettrich, that sounds to make some sense. But I'm using a single pin.

Wha5 size resistor do you have with the LED?

What is connected to that pin, and how?

Is the other side of the Arduino plugged into the computer via USB, or is it powered some other way?

Delta_G - Has he said it's a led? Unless I missed something, he's talking about the LED on the board, which blinks as optiboot does it's thing, after the arduino has reset (which is the problem he's dealing with)

Jovann: I'm not doin' that . I'm just trying to keep lightened a led. This is the code I'm using:

int x=7;
void setup(){
  pinMode(x,OUTPUT);
  digitalWrite(x,HIGH);
}
void loop(){
}

There is nothing wrong with that code. So your problems are elsewhere in the hardware not your code. Schematics and well focused pictures help a lot in cases like this.

DrAzzy: Delta_G - Has he said it's a led? Unless I missed something, he's talking about the LED on the board, which blinks as optiboot does it's thing, after the arduino has reset (which is the problem he's dealing with)

Sorry, I guess I misread something.

As this output is turned on immediately at power up and is not turned off by the code, why is the load not just connected to the power??

Weedpharma

Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png? And/or a picture of your layout.

Thanks Tom...... :)

DrAzzy:
What is connected to that pin, and how?

Is the other side of the Arduino plugged into the computer via USB, or is it powered some other way?

Delta_G - Has he said it’s a led? Unless I missed something, he’s talking about the LED on the board, which blinks as optiboot does it’s thing, after the arduino has reset (which is the problem he’s dealing with)

DrAzzy. This whole situation seemed to be silly also for me. But sometimes which’s obvious is hard to see. I were always testin’ the code with the usb connector. I powered my UNO with a 9V source. Output remained latched. Thanks :slight_smile:

DrAzzy: What is connected to that pin, and how?

Is the other side of the Arduino plugged into the computer via USB, or is it powered some other way?

Delta_G - Has he said it's a led? Unless I missed something, he's talking about the LED on the board, which blinks as optiboot does it's thing, after the arduino has reset (which is the problem he's dealing with)

Sometimes which is obvious is hard to see. I was testin' my code via usb connector. I powered my UNO with a 9V source. Output remained latched as it should be. Thanks DrAzzy :)

TomGeorge: Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png? And/or a picture of your layout.

Thanks Tom...... :)

Dear Tom. No further need of that. I was always testin' the cirtuit via usb. I powered my board with a 9V source and the pin stayed latched. Feel dumb about it. As I was only lighting a led, I assumed there would be no problem with the usb power.

I assumed there would be no problem with the usb power.

There is no problem with USB power. You have something wrong. It should have worked with USB power.