Unplugged dryer. Removed front panel. Unplugged wires on door switch. Then I connected the wires and tried the dryer, and it ran okay, so I knew that the problem was the door switch.
Installed the new door switchand and plugged dryer backin and dryer now starts.