equaling two pins.

in a condition i want to connect boards input and output.
i mean i want to equal two pins.
how can i achieve this ? :relaxed: :relaxed: :relaxed:

int i;


void setup() 
{                
 
  pinMode(4, OUTPUT); 
  pinMode(5, OUTPUT);   
  pinMode(6, INPUT); 
  pinMode(7, INPUT);   
}

void loop() 
{
if ( i< 10)
{
  
  digitalWrite(4, 6); 
} 
  
}

in this sample code i want to achieve input pin 4 = output pin6 .
so cai i do through this

digitalWrite(4, 6);

No, that will always output HIGH, because 6 is non zero.
Did you mean to read pin 6 (hint) and write that value to pin 4?

There is a tutorial section here - http://arduino.cc/en/Tutorial/HomePage - with a lot of example code,
please take a few days to work through these examples to learn the basics of the Arduino language.
You will learn a lot of things by going through these code examples especially when you modify the sample code and run it on your board.

  1. digitalWrite(6, digitalRead(4)); is what you are looking for.

rajeetharan:
in a condition i want to connect boards input and output.
i mean i want to equal two pins.
how can i achieve this ? :relaxed: :relaxed: :relaxed:

Just connect the output directly to the input, avoiding the Arduino completely? Writing a sketch that emulates a bit of wire seems rather pointless.

But it would be a bit of wire with a delay :slight_smile:

Surely it would be better to use millis() wire in most case.

Only @ 20 MHz

Docedison:
Only @ 20 MHz

I have no clue what this means. Can I have some of what you're smoking?