Needs lots more information on the ports.
For Digispark - The tiny, Arduino enabled, usb board!
P4, for example, reads 0 when connected to 5 volts by a 100K, or a 33K resistor. The pin is at 1.9, or 2.1 volts with these resistors. So P2 was read with analogRead(2) and it's value compared to 1.9/2 to solve the inability to do a digitalRead(4). Proper documentation would have saved a lot of time!!
Response from Digistump | Dec. 26, 2014
Thanks for trying out the Digispark - I'm not sure if you saw this but we have lots of documentation at http:/digistump.com/wiki/digispark - including this page: http://digistump.com/wiki/digispark/quickref with lots of useful info about the pins
We also have a pretty active community on our message boards at digistump.com/board ready to answer these kind of questions, and help out in general.
Thanks again and we'll continue to work to improve our documentation!