Everything works fine when I use the USB to power the Leonardo. But when I use a 9V to the RAW/GND, the unit lights up but does not function. I'm also using an HC-SR04 Ultrasonic Sensor with my project. Do I need something else to power the unit when going with a 9V battery?
But when I use a 9V to the RAW/GND,
By RAW do you mean Vin?
but does not function
What function are you expecting?
Is your battery powerful enough? small ones won't deliver much current
Allan