"expected unqualified-id" Error after trying to add delay to parts of script.

Pick a decent name like "tempSensor" or something for your sensor object and this won't happen again