Why does my car stalls when I come to a stop when the heat is on. on 2007 Chevrolet Cobalt

The car seems to drive fine on an open rode it's just when I come to a stop the car dies,only if the heat is on it starts back up but the heat has to be off.If I don't run the heat and come to a stop it's fine.My check engine light is on also

by in Columbus, OH on December 14, 2012
Get Your Car Fixed at a RepairPal Certified Shop.
We certify shops based on expertise, quality work, and verified customer reviews
2 answers 2 comments
ANSWER by , December 14, 2012
most likely the cooling fan for the ac is not working or it has a bad camshaft actuator . is the check engine light on?
ANSWER by , December 14, 2012
What are the trouble codes?
COMMENT by , December 14, 2012
Not sure they said my sensor in my gas pedal
COMMENT by , December 14, 2012
Post the code(s) so we can help.