send digital pin output from Arduino Mega to Arduino UNO

I have tried to send digital output of arduino mega to arduino uno as digital input through npn transistor.

Base of NPN transistor(BC547B) is from pin 5 of mega.

collector is connected to 5 volt of uno.

emitter is connted to common ground of both microcontroller.

but it does not work..can anyone please let me know... is this possible to do.

is this possible to do.

Yes. The transistor is not necessary. Simply connect the output pin of one Arduino to an input pin of the other Arduino and connect the grounds.

Then, write the proper code.

thank you very much for your reply..do i need to resistor in between that....

If you connected an NPN transistor with collector to 5 volts and emitter to ground, then the transistor may be destroyed. As written previously, you don't need the transistor anyway.

A resistor is not required but is handy for protection. Use about 500 ohms and use 1/10 watt or more.

Tie the grounds of the Arduinos together.

Make sure to power the Arduinos simultaneously, or power up the Uno (the receiver) first.

THANK YOU ....vaj4088