Arduino input pin

what is the minimum and maximum power that the arduino can read in the digitalread command? and what pin should i use? tnx

brian25: what is the minimum and maximum power that the arduino can read in the digitalread command?

The input voltage of digital input is 0 to 5V, 0V is logic 0 and 5V is logic 1, current is very low, what power are you looking for?

brian25: and what pin should i use? tnx

All 20 pins, Digital input D0 to D13, analog input A0 to A5

i'm using 5 volts

this is my simple program. if(digitalRead(PIN) == LOW) { Serial.println("LED ON"); }

if(digitalRead(PIN) == HIGH) { Serial.println("LED OFF"); }

but i have a littlebit problem.. how to isolate an event if the program reads that part, it will not jump on that part again and again. and it will only execute that part if the pin value changes? tnx

http://www.gammon.com.au/switches

int pinA = 11; int pinB = 12; int val;

void setup() { pinMode(pinA, OUTPUT); pinMode(pinB, INPUT); }

void loop() { int(); }

void int() {

val=digitalRead(pinB); // read data if(pinB == HIGH) { Serial.println("PINA ON"); //write serially } else if(pinB == LOW) { Serial.println("PinA OFF"); //write serially } }

the message is keep repeating. how to stop the message in serial monitor even the pin is still in continuous active high or low status. it's just a one time message.

You are in a loop function, everytime it loops it checks to see if the pin is high or low. You'll need to look for a change in state, rather than directly at the state.

Try making this small change:

void int()
{
  
  val=digitalRead(pinB); // read data
 if (val !=oldval){  // did val change from last time?
  oldval = val;  // store old state, then print changed state
  if(val == HIGH)
  {
    Serial.println("PINA ON"); //write serially
  }
  else
  {
     Serial.println("PinA OFF"); //write serially
        }
 }

brian25: the message is keep repeating. how to stop the message in serial monitor even the pin is still in continuous active high or low status. it's just a one time message.

Read the link I posted, that's how. You detect a state change, as mirith said.

http://www.gammon.com.au/switches