Reving engine

On my way to the grocery store my car’s RPMs started to pulse up and down (between 1 and 2) when driving. While stopped at the red light it would vibrate very hard. When i put it in park the RPMs would rise fast before i shut it off. It did the same things on the way back home plus the check engine light came on. A few hours later i put a little oil in it and drove it around my neighborhood and it didn’t do any of the things it did that morning. Could anyone shed some light on the problem for me?

You need to get the code read. Unless you live in California, any AutoZone and many other care parts stores will read the codes for free. They will make a recommendation, but first, get the code (P0xxx) and post it here. Someone here might have a particular insight to certain codes in certain cars.

p0505 it’s the idle air control system.

It does sound like the problem is related to the IAC.
However, one thing in your post disturbs me, namely, “A few hours later i put a little oil in it and drove it around my neighborhood…”.

I hope that the engine actually needed oil before you added it.
Believe it or not, we have had some posters over the years who apparently thought that adding oil (even if there is no indication that the engine is low on oil) was sort of like taking an aspirin for a headache. Those folks wound up with bigger problems as a result of overfilling the crankcase.

Did a check of the dipstick indicate that the engine was low on oil?

Yeah it was low but not enough to make the light come on.My car burns through oil really fast and I have to check it every 2-3 days just to make sure i’m not running bone dry.

Well, either you got the codes read really fast or the code was a really strange thing to leave out of your original post.

At this point I’m not sure what the question is. It is a fault code that gets set due to the detection of electrical faults. Someone needs to check the wiring/power supply for the IAC. If everything is on order with the wiring then you probably just need a new IAC valve. There is some chance of a PCM problem but that isn’t likely and should become apparent when checking the wiring.