While flying through Philly class B airspace today I encountered a problem. My battery started to die. I was able to get my radios to work temporarily after recycling the master switch and advised Philly, who I was already talking to, and had a clearance with, that my radios were going out. After a somewhat garbled response I squawked 7600 and descended out of the Bravo and went about my way VFR until I could land. I am a low time pilot still and am wondering if I could have done anything differently, or worse, could I have done something wrong?