digital pin value changing

I gave 4.8v DC to arduino digital pin . I used digital read (pin12) into a variable 'Val' . it worked yesterday , Val returned 0 when 4.8v was shorted and 1 when supply was there .. now even when providing 4.8v DC , serial monitor is showing 0s and 1s simultaneously .

Where does the 4.8v come from? If it is a separate power supply from the Arduino do you have the GNDs connected?

You need to post your program and a diagram showing all your connections. See this Simple Image Guide

...R