top of page

Physical Computing Week 1: Thursday Labs

Quiz Answers:

Question 1:

In a properly working circuit, an electric current transfers energy from the power source (battery) to circuit components. A properly working circuit has a conductive path such as a wire where energy is transported, a power source, and a load which consist of the components that draw energy or require energy. In a DC circuit, energy is transferred from the power source and follows the path of least resistance to the load (from + to -).

Question 2:

A short circuit is a direct connection outside of the circuit that provides less resistance than the intended circuit, and reroutes the current. This can cause overheating and damage to components not able to withstand the amount of energy transferred.

Question 3:

A. Voltage regulator

B. Switch

C. Resistor


E. Ground

Question 4:

A voltage regulator outputs and maintains a consistent voltage, regardless of changes to input voltages. They are often used to power components with specific, limited voltage requirements.

Switches are used to control the direction of electrical flow in a circuit, and oftentimes require physical manipulation to make changes to the circuit.

Resistors provide electrical resistance to a circuit and are helpful for limiting the flow of electric current to protect components from excessive electrical energy.

LEDs are oftentimes used as indicators to provide feedback for other processes.

Ground is a return path for an electrical component, which can also be used as a place to safely discharge excess electrical energy. It is considered a safety feature for electrical systems to prevent damage to components.

Question 5:

V = i * R

5 - 2 = 3 V required

3V / 0.02A = R

R = 150 ohm resistor

If you want to decrease the brightness of the LED, you could use a higher value resistor, but not too high because you still need a minimum voltage (depending on the LED) for the LED to turn on.

Question 6:

When troubleshooting you should check:

- schematics if you're following one

- check part functionality

- check wire connections

- check that power supply is working

Question 7:

In Series

R1 - LED 1

R2 - LED 2

R3 - LED 3

In Parallel

R1, R2, R3

LED 1, LED 2, LED 3

Question 8:

A. Current

Question 9:

B. Voltage

Question 10:

B. Voltage

Question 11:

A. Current


I had a really hard time getting my Arduino to work on my PC laptop after trying and failing to get it working on my mac. After about 2 hours I managed to get everything communicating and working properly. I had to reinstall and redownload the appropriate board package for the Nano 33 IoT. But finally I was able to send some code!

I followed the tutorials and was able to get everything working, although I struggled with the photocell as I kept switching the leads and incorrectly wired them the first few times and either wasn't getting any readings or getting 1s and 0s. I rewired everything from scratch and got it to work, but the values were quite low in my apartment. Thinking that I had done something wrong again, I rewired it once again. It turns out my apartment was rather dim and not producing very high values, so the photocell was working just fine and I had done everything correctly.

I'm still adjusting to working in processing, as honestly it's been a long time since I've used it but hopefully it won't be too hard to adjust to this from working in p5.js.

My first code using a button to control the on/off state of two LEDs, code below:

void setup() {
  // set the inputs and outputs
  pinMode(2, INPUT); // set pushbutton pin to be an input
  pinMode(3, OUTPUT); //set led 1 to be an output
  pinMode(4, OUTPUT); //set led 2 to be an output

void loop() {
  // read the pushbutton input:
  if (digitalRead(2) == HIGH) {
    //if push button is closed:
    digitalWrite(3, HIGH);
    digitalWrite(4, LOW);
  } else {
    // if push button is open:
    digitalWrite(3, LOW);
    digitalWrite(4, HIGH);

I initially made a typo in my code where I didn't set pin 4 as an output pin (I typed 3 twice instead of 4), and this is what happened: It still technically worked, but the LED was very dim, so I'm not really sure why this is happened.

Controlling the brightness of an LED using a potentiometer, code below:

const int LedPin = 9; //pin LED is attached to
int analogValue = 0; //value from potentiometer
int brightness = 0; //PWM pin that LED is on

void setup() {
 // initialize serial communications at 9600 bps:
    // declare the led pin as an output:
    pinMode(LedPin, OUTPUT);

void loop() {
analogValue = analogRead(A0); //read potentiometer value
brightness = analogValue /4; //divide by 4 to fit in a byte
analogWrite(LedPin, brightness); // PWM the LED with the brightness value
Serial.println(brightness); //  // print the brightness value back to the serial monitor

The CORRECTLY assembled breadboard with a photocell sensor, working properly. Code below:

void setup() {

void loop() {
int photoCellState = analogRead(A1);
Serial.print("photocell: ");

I didn't have enough time to play around with sound, the speaker also scares me a little bit, but I will repeat these exercises with the speaker to make sure I understand how to manipulate the audio.

Once thing I'm still a bit confused about it when to add a delay to the code, is that just when reading the analog pins? Do I need to add a delay if I read, then write, then read again? I'm guessing I don't need to worry about it for the digital side? That part was a bit unclear to me.


bottom of page