Check with the previous owner whether the stator recall was done; if not, arrange to have it done by a Yamaha dealer.
If you got a CEL, there should be a Fault Code posted; find out what that is and report back.
From what you describe, it's probably a regulator/rectifier issue; go to page 8-76 of the service manual and follow the instructions for checking the stator and the regulator/rectifier.