2007 Chevrolet Cobalt Q&A

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

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 -
Answer 1
What are the trouble codes? -
Comment 1
Not sure they said my sensor in my gas pedal -
Comment 2
Post the code(s) so we can help. -
Answer 2
most likely the cooling fan for the ac is not working or it has a bad camshaft actuator . is the check engine light on? -