Did you accidentally turn on Sleep Mode or Do Not Disturb?
With the screen on, swipe left to Settings. Click on Settings then swipe up and check both settings to be sure they aren't on/enabled.
Thank you that worked
How can I access to the settings in my phone to see if my charger is in sleep mode?