allows two different methods of output: one as pwm at half the voltage, the other as usual digitalWrite command; added a 10K resistor