Hi Jackjardine,
Thank you for visiting the HP Support Forums and Welcome. I have read your thread on your Deskjet 2540 and having issues connecting to the wireless. On the front panel click the wireless icon and turn off the wireless.
Disconnect USB from the computer restart the computer. Then plug in the USB cord. Make sure the printer is connect to wall outlet directly no power strips or surge protectors. HP Print and Scan Doctor will help you connect your device.
Hope this helps.
Thanks.