Help with code that is not working correctly

Have you connected the grounds?