// Web Control with the Imp class ledIn extends InputPort { function set(v) { server.log("led: " + v.led + " " + ((v.led == 0) ? 0: 1)); server.log("motor: " + v.motor) if (v.led == "0") { hardware.pin1.write(0); } else if (v.led == "1") { hardware.pin1.write(1); } if (v.motor == "0") { hardware.pin2.configure(DIGITAL_OUT); hardware.pin2.write(0); } else if (v.motor == "1") { hardware.pin2.configure(PWM_OUT_STEPS, 0.01, 0.5, 2); } else if (v.motor == "2") { hardware.pin2.configure(DIGITAL_OUT); hardware.pin2.write(1); } } }; // Register with the server imp.configure("WiFi Control", [ ledIn("LedValue", "number") ], []); hardware.pin1.configure(DIGITAL_OUT); hardware.pin2.configure(DIGITAL_OUT); hardware.pin2.write(0) // End of code