Hello arduino10134
Post your entire sketch, well formated, with comments and in so called code tags "</>" and schematic, not a Fritzy diagram, to see how we can help.
Have a nice day and enjoy coding in C++.
The switch only works to control the motor when the smoke value is <100. If the smoke value is >100, the motor is running and i am unable to switch it off using the switch.
Do serial prints of smokeValue and switchState just before the if so you can see what they actually are. Do serial prints in each "leg" of the if so you can see if it actually goes where you expect, or not.
edit.. are you sure you want the pin for a switch to be an output? And anyway, show a wiring diagram so we can see how the switch is wired. You need a pullup or pulldown resistor to guarantee a known value always; convention wisdom is to wire switch to ground and use INPUT_PULLUP in pinMode.
Wire the switch from the pin to ground. When doing it that way, the pin will read high when the switch is open, and low when closed- it's a pretty standard practice.
Put serial prints in, and wire the switch correctly (or at least show how it is wired). Nobody can really help without some decent diagnostics from your side.
"If the switchState is HIGH or the smokeValue is greater than 100, turn on the motor". That will keep turning on the motor whenever the smokeValue is greater than 100 regardless of the 'switchState'.
Maybe you meant to say: "If the switchState is HIGH and the smokeValue is greater than 100, turn on the motor". That would be:
if (switchState == HIGH && smokeValue > 100)
{
digitalWrite(motor,HIGH);
}