I stopped taking Percocets, is it OK to take Ambien?

I stopped taking Percocets 3 days ago on my own the only problem I’ve had is it’s hard to sleep I do I have Ambien wondering if it’s ok to take now I was taking 5 mg of Percocets 4 times a day for 2 years just wanted to stop taking them had a little diarrhea but not bad.

Age: 63
Medications: Eliquis, carita xl, carvedilol,and enalaprlil
General Information: Just got tired of taking the drug was on it for 2 years and wanted to stop the Percocets