Simple Instrument – Pocket Piano

For this assignment, I built a PocketPiano – this is a simple 4-key handheld piano. The schematic and the actual device are shown below.  This device can be used with only one hand. Each button has a corresponding sound, determined by different frequencies. the buttons themselves serve as signifiers, since for most people, it is intuitive to press a button even without instruction to do so.  The accordance is the ability to play music, or more specifically, a single note for each button. 





Assignment 6

For this assignment, I created a basic piano – called PocketPiano – that only has four notes and four buttons for keys. For every note you play, the serial monitor shows you the corresponding color to that note. 

This is the code: 


This is the serial monitor: 

This is the instrument:


Assignment 5

For this assignment, the servo moves 180 degrees when a button is pressed followed by a short tune. Then the servo goes back to its starting position.

This is the schematic:

This is the code:


This is the serial monitor:

Assignment 4 – servomotors

For this assignment, I made the servomotor move 50 degrees rapidly in a bright environment, and move 180 degrees slowly in a dark environment. 

The schematic is shown below: 

The code: 

The serial monitor while varying brightness: 

Assignment 3

Part A: 

The Analog>Fading tutorial and Basic>Fade tutorial essentially produce the same effect on the LED – a fading  brightness effect – and both use analogWrite. However they function in different ways.

The Analog>Fading presets the upper and lower limits for brightness and sets the fade increment to oscillate within those two values. It uses separate for() loops for the brightening and dimming. The fade increment is set separately as +5 and -5 for each loop. This type of fade can be utilized for multiple LEDs at once, as shown in the tutorial. 

The Basic>Fade keeps resetting the brightness variable and uses analogWrite to control the brightness of the LED. The brightness value becomes the previous brightness plus the fade increment and once it reaches the limits 0 or 255, the fade increment becomes a reduction of the same value. The microcontroller keeps saving the brightness as a new value with each execution of the loop. Since There is only one single loop() function, this code can only be used for a single LED at one time. 

Part B:

Below is the code for the Serial.print, along with a screenshot of the serial monitor printing the values and labels.  

Part C: 

Below is the code for “Blink without delay”. I inserting two serial.print functions, for every time the light switches from on to off or off to on. This is just to corroborate that the blinking is in line with the code and not random. Also, in the case it does’t work, the serial.print is helpful to determine whether the problem is in the code or the circuit.  


Assignment 3

This circuit blinks a red LED at different brightness values for different amounts of times and then fades a blue LED for an indefinite amount of time.  The red LED blinks has a set blinking pattern and then turns off – this is because the code is written in the setup() section, which means once Arduino executes the code once, it stops. The blue LED, however, is controlled by the loop() section, meaning the code will keep running over and over again once it reaches the end.  The Serial.printIn() is included in the loop, which allows the serial monitor to print out the brightness values of the fading blue LED every time the fade amount increment changes. 



// Blink red LED then loop fade blue LED

const int redPin = 11; // assign red LED to pin 13

int bluePin = 9; // assign blue LED to pin 9
int brightness = 0;
int fadeAmount = 10; // fade the blue LED by 10 points
int fadeSpeed = 100; // the speed at which the fadeAmount changes incremmnts

void setup() {
pinMode(redPin, OUTPUT); // assign outputs
pinMode(bluePin, OUTPUT);

analogWrite(redPin, 0); // set the red LED to varying brightnesses for varying amounts of time
delay(200); // this will run only one time
analogWrite(redPin, 100);
analogWrite(redPin, 255);
analogWrite(redPin, 50);
analogWrite(redPin, 0);

void loop() {

analogWrite(bluePin, brightness); // set initial brightness of blue LED
brightness = brightness + fadeAmount; // change brightness value to the brightness after runnig through the loop

if (brightness <= 0 || brightness >= 245) { // fade out after reaching maximum brightness
fadeAmount = – fadeAmount; //changing fade amount to negative to reduce brightness

Serial.println(brightness); // print brightness values
delay (1);


Screenshot of serial monitor for fading blue LED brightness: 

Assignment 2


For this circuit, the LDR quantifies light intensity. In very dim or no light, the red light turns on. In normal room fluorescent light, the yellow light turns on. And a green light signifies bright light. 



In normal room light:

In dark light (covering light sensor): 

In bright light: 



int red = 13; // assignment of variables
int yellow = 12;
int green = 11;

void setup() {

pinMode(red, OUTPUT); // assignment of pins
pinMode(yellow, OUTPUT);
pinMode(green, OUTPUT);


void loop() {

int sensorValue = analogRead(A0); // read and print values for light intensity

if (sensorValue < 550) {
} // red light turns on in the dark
else {
digitalWrite(red, LOW);

if ((sensorValue > 550) && (sensorValue < 900)) {
digitalWrite(yellow, HIGH);
else {
digitalWrite(yellow, LOW);
} // yellow light turns on in dim-normal light


if (sensorValue > 900) {
digitalWrite(green, HIGH);
else {
digitalWrite(green, LOW);
} // green light turns on in bright light

Assignment 1 – NYUAD Privilege Project & Blow Switch

This is an interactive storyboard that brings attention to the privilege of NYUAD students through the juxtaposition of different scenarios that occur at the same time and place. The user clicks and drags the each scene onto the board.


The Blow Switch: a metal frame is fixed on one end of a nonconductive string while a moveable conductive foil rests on the other end. Each element is connected to one side of the series circuit with a resistor and LED light. The user has to blow (using a blowdryer or mouth) the sheet of conductive foil onto the frame to complete the circuit and blows from the other direction to cut it.

Blow Switch Schematic