P Comp Week 2 Labs

Digital Input and Output with an Arduino


Preparing the Breadboard and Adding a Pushbutton

Why does the pulldown resistor need to be a 10kΩ? How does it correlate to the button/switch?

Adding Digital Outputs (LEDs) and Programming the Arduino

When it came to programming the board, I wrote out all the code and got to the compiling and uploading stage only to receive errors saying that the programmer wasn’t responding and there were sync issues.

This is how I attempted to troubleshoot:

First, I made sure the connection between the Arduino and my computer were secure.

Then I tried unplugging and plugging the cable back (both to the Arduino and also my computer).

Made sure I had the correct port selected, it was.

I did notice that the /Board submenu was still set to the Arduino Uno, so I changed it to the Arduino Nano 33 IoT. Then I recompiled and tried to upload again, I was faced with the same error messages.

I tried restarting the Arduino IDE software, still no changes.

I went back to read the lab directions and followed the steps again to make sure I had done everything correctly. In the /board manager window I researched the Nano 33 and noticed the version dropdown menu I hadn’t noticed before, and when rereading the instructions, realized I had not installed the 1.8.9 version of the board definition.

That fixed my issue and I was finally able to upload the program.

Analog Input


Adding a Potentiometer and LED, and Programming the Module

At first I got some errors, but then quickly realized that in order to establish the global variables I had to place that bit of code at the very beginning.

Using a Force Sensitive Resistor

Sensor Change Detection


Programming the Arduino to Read the Pushbutton’s State Change

Counting Button Presses

Detecting a Long Press or a Short Press

Reading a Sensor Threshold Crossing

Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s