Go Down

Topic: HIGH is off and LOW is on (Read 2286 times) previous topic - next topic



I have had my Arduino Ethernet now for 6 months. LOADS of fun with it. But I have noticed when I write a pin HIGH it turns it off and if I write it LOW it turns it on. It as been the way since I got it. Is there something wrong with it?

I also noticed that the analog pins read 0 when I put power to them. Is that right?



What is the "it" that is turned on or off?
If "it" is a LED connected to a pin, it depends how it is wired as to how it behaves.
Where is your code?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

jack wp

When you write LOW, the pin should go to ground ( is that on or off to you), and vice versa.
Have you used a volt meter to see what you are getting?

jack wp

I also noticed that the analog pins read 0 when I put power to them. Is that right?

Well, if you put to much power, they may burn up.

They read voltage, normally between 0 and 5 volts.
What "power did you put on what pin? What code did you use to read, and display that?


But I have noticed when I write a pin HIGH it turns it off and if I write it LOW it turns it on. It as been the way since I got it. Is there something wrong with it?
Current flows when there is a difference in voltage.   If you connect one end of an LED/resistor to +5V and the other end to an Arduino output, the LED will come on when the ouput goes low (assuming it's wired with the correct polarity ;) ).

If both ends of the LED/resistor are connected to 5V, there is no difference, no current will flow, and the LED won't light-up.   It's sort-of like water-flow...  If there is no pressure difference, or a difference in height, the water won't flow... And the direction of the water-flow is always from high-to-low.

Similarly, I'm using the internal pull-up resistor on an input with a switch wired to ground.  When I turn the switch on, it pulls the input low.

I also noticed that the analog pins read 0 when I put power to them. Is that right?
Something's wrong...  If you connect +5V to an analog pin, it should read (about) 1023.  The "power" needs to share a common ground with the Arduino.   (Again we are looking for a difference, and you need the ground reference.)  And, you can damage the Arduino by applying a negative voltage or a voltage higher than +5V.


For example, in the sketch below I have to turn led to LOW to get it to turn on. If I set it to HIGH then the led will not turn on.

For the analog, if I turn on pin 8 and jump it start to A0. Thats when I get a reading on the serial monitor of 0.


Code: [Select]
int led = 5;

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

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(led, LOW);   // turn the LED on (HIGH is the voltage level)


The only way this is possible is if you've got it wired up wrongly.

for example. digitalWrite(3,HIGH);  Pin 3 spits out 4.7v or whatever it is.

All I can think of is, that you have +5v connected to the negative side. so when you
do LOW, it completes the circuit, up until that point the potential difference is equal?


One could write low to a PNP transistor and get light, but cj's assumption of mis-wiring seems right.


Sink or source for the LED? If the LED is connected to the 5 pin and +5v, then the led might light when the 5 pin goes low.
Google forum search: Use Google Search box in upper right side of this page.
Why I like my 2005 Rio Yellow Honda S2000  https://www.youtube.com/watch?v=pWjMvrkUqX0


Take a moment to think about the following 2 circuits, and you may realize the answer to your question (especially if you examine circuit 1):

Code: [Select]

Circuit 1:
Vcc ----/\/\/\---|>|---Arduino Pin

Circuit 2:
Arduino Pin---/\/\/\---|>|---GND

--|>|--  Diode
-/\/\/\-  Resistor

PS (I'm far too lazy to draw these in something other than text)


Ok, I unplugged everything from my arduino and put a volt meter to it. The pins are giving me over 4 volts when I turn them to HIGH. So that left my relay module. So I did some testing on it, and turns out, to trigger a relay on it, it needs a ground signal sent to them. I remember not being able to find any information on the wiring on it when I got.

Was that bad for the arduino for it to be hooked up that way? How do I go about sending ground signal to each relay with the arduino board

Here is the relay I am using.


Thanks for all your help.


What happens when you set the arduino pin LOW?


You are using a relay to turn on an LED?

Do mirith's simple circuit #2.  The LED will shine when you write the pin HIGH.

jack wp

No need to use a relay to light a (normal) led. If you do want to use the relay board, and a LOW activates the relay  (that is sorta an inverter circuit). You can invert it again. One way is to use the other side of the relay output. If you are going to NO (normally open), just switch to NC (normally closed).

I assume you are just experimenting, not creating any mission critical system.


Option #3:
Code: [Select]

//At the beginning of your code before anything
#define ON LOW
#define OFF HIGH

digitalWrite(ledPin, ON);

PS, watch that you don't over current each pin if using the Arduino to drive the LED
PSS, I hear transistors can act like digital switches, and are cheaper than relays.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131