Search code examples
arduinoswitch-statementservo

Switch connected to an Arduino not working in Tinkercad Circuits


See image: after terminating it rotates to 180 and back to 0 while staying rotating between 0 and 90. And nothing happen if I turn the switch. Don't know what I'm doing wrong. Oh, it could also be the program. enter image description here


Solution

  • Please Connect a resistor at pin 2 to ground so by default when switch is in off state low voltage is present at pin 2 and else condition is able to work.