Have you tried resetting the SMC?
To reset the SMC:
1.Shut down the computer.
2.Plug in the MagSafe or USB-C power adapter to a power source and to your computer.
3.On the built-in keyboard, press the (left side) Shift-Control-Option keys and the power button at the same time.
4.Release all the keys and the power button at the same time.
5.Press the power button to turn on the computer.
On MagSafe power adapters, the LED might change states or temporarily turn off when you reset the SMC.
If that doesnt work try reseting the NVRAM:
Resetting NVRAM
1.Shut down your Mac.
2.Locate the following keys on the keyboard: Command (⌘), Option, P, and R.
3.Turn on your Mac.
4.Press and hold the Command-Option-P-R keys immediately after you hear the startup sound.
5.Hold these keys until the computer restarts and you hear the startup sound for a second time.
6.Release the keys.
After resetting NVRAM, you may need to reconfigure settings for speaker volume, screen resolution, startup disk selection, and time zone information.
If both of these dont work then you could try a hardware diagnostic check:
Using Apple Hardware Test
1.Shut down your computer. Then, press the power button to turn it back on.
2.Press and hold the D key before the gray startup screen appears.
3.It takes a minute or so for AHT to start up and inspect your hardware configuration. While this is taking place, an icon appears on the screen:
4.When the process is complete, select your language and click the right arrow. If you aren't using a mouse, you can use the up and down arrows to select a language and then press the Return key.
5.The AHT console appears. You can choose which sort of test or tests to perform: •To perform all of the basic tests, click the Test button or press the "T" key or the Return key.
•To perform a more thorough diagnostic test, select the "Perform extended testing" checkbox under the Test button before you click the Test button.
Note: Your test results will appear in the window in the bottom-right of the console.
6.To exit AHT, click Restart or Shut Down at the bottom of the window.
If the diagnostic test doesnt show anything then just take it to your nearest Apple store or an Apple authorised service centre and they will check it for you.