Digital Input (a Pushbutton)
Connect a 220-ohm resistor and an LED in series to digital pin 3 and another to digital pin 4 of the Arduino. Figures 14, 15, and 16 below show the schematic view as well as the breadboard view for both the Uno and the Nano. If you prefer an audible tone over a blinking LED, you can replace the LEDs with speakers or buzzers. The 220-ohm resistor will work with LED, speaker, or buzzer. **
When I first did the experiment, I mistook the resistance value (220-ohm > 10-ohm) connected to the switch and connected the wrong resistance. Because of this, the switch did not work and only the yellow LED was on continuously. After checking the position of the connected resistance again, the resistance was changed from 10-ohm to 220-ohm, and the switch was also strongly fixed once again, and it worked. (I had to press everything harder than I thought.)
Since I am not familiar with coding yet, I connected nano 33 to Arduino according to the manual accurately written on the page, and also wrote the input and output coding values as well.
Before Programming If you’ve never used the type of Arduino module that you’re using here (for example, a Nano 33 IoT), you may need to install the board definitions. Go to the Tools Menu –> Board submenu –> Board Manager. A new window will pop up. Search for your board’s name (for example, Nano 33 IoT), and the Boards manager will filter for the correct board. Click install and it will install the board definition.
The potentiometer is mounted in the left center section of the solderless breadboard. Its outside pins are connected to the voltage and ground buses, respectively There is a wire connecting to analog in 0 of the nano (physical pin 4) to the the center pin of the potentiometer. An LED is mounted in the right center section of the board, with a 220-ohm resistor attached to its anode (long leg). The other end of the resistor connects to the Nano’s digital pin 9 (physical pin 27). The cathode of the LED (short leg) connects to ground. If you’re using a speaker instead of the LED, connect it to the same connections as the LED.
Setting Breadboard & adding potentiometer & LED / Program Arduino