Processing Assignment, October 16, 2017

For this assignment, we had to familiarize ourselves with Java and Processing. In order to do so, we were asked to separate the assignment into two parts. 

1. Self-Portrait 

We had to create a self-portrait on Processing. This is harder than it looks! I utilized a project I had previously seen in order to get a sense for what functions exist in terms of shapes (the different types of curves, how to define six parameters instead of four, etc). For me, the hardest part to achieve was the hair, although it is mainly constructed out of lines. It was hard to get a sense for the x and y location in relation to the face. I tried my best, and this was the result:

Attached is also my code:


2. Rectangles on loop 

The second part of the assignment was to create five rectangles in different places using a for loop. Although we became familiarized with for loop using Arduino, it was still difficult to understand this task. Again, the thing I am having the hardest time with is getting the x and y locations and what those really mean. A tip for everyone: draw! It was super helpful to draw an x and y simple graph like you would in school, and visualize what you are trying to do on your Processing canvas. This was the result of my rectangles:

Attached is also my code:


Assignment due October 11th, 2017: Motors

For this blog post, I will not review one of my peer’s circuits, because I was not in class the past time, so I did not get to see any of the toys aside from mine, which I reviewed in my last post, where I included things that could be improved or how I would change things. 

I took the direction on “how a human moves” very loosely for this, and decided to transmit a human emotion rather than a human literal motion. I adapted some of what I had done to my rat trap circuit earlier, given that I was using a motor for that assignment already. I chose to make it with the same pedal, which when held, would activate the motor, and turn a heart shaped cardboard round and round. Because when you’re in love, your heart just won’t stop spinning!! 

Attached is a video of the very simple project:

Assignment due October 9th, 2017-Whimsical circuit

For this project, I decided to create a rat trap out of scratch. I was very inspired by the ideas of design and craft that we have been discussing, so I decided to do a somewhat elaborate looking trap. I chose to do this because I wanted to make a little monster who would swallow coins, but after four hours of work, I realized that the motors we had would never work for this kind of project. I researched what good uses 9V motors have, and the idea of a trap came along. 


Creating a little object that would sit on the motor that would pull the string was kind of complicated, although it’s a super simple solution. Also, I realized late into the night that this program was supposed to demonstrate our skills in programming. When I asked last class if we had to use Arduino, I was implying, do we have to use programming? However, since I was not clear enough, I decided to try to make circuits we haven’t really done in this class, which involve a lot of soldering and knowing how things connect without the use of a breadboard. My circuit now contains a battery, a 9V motor, a resistor, an on and off switch (a suggestion from last time), and other components that help these cardboard flaps close on each other.


I would definitely try to paint it and find another way to secure things that isn’t hot glue. I would also add some programming element that fits. 

Attached is a video of it working. At this time, the battery was kind of low on charge so the trap wasn’t fully closing, but it does fully close!! 

Instrument Assignment due October 2, 2017


For this assignment, we had to create an instrument and think of the design for it. With the help of a tutorial, I managed to make a very simple instrument that works with a touch pot. When you run your fingers through the touch pot, it creates a series of fun sounds. My idea was to do this in order for it to function as a “tongue” and created a smiley face. The smiley face has a mouth cut out, through which the touch pot can stick out. This was the design portion of my assignment.


There were so many complications with this, starting with the touch pot. In order for the design to properly work, I needed the touch pot to not be directly attached to the breadboard, but a bit further from it. I thought that maybe I could solder some extra wire to the touch pot, but due to the fact that it’s made of plastic, it was very likely that it wouldn’t work. And it didn’t. A friend in the lab while I was working, Heorhii, took up the challenge and said he would make it work. And he did! He managed to make the touch pot a bit more extended in order to help with the design. The other problem is the design. I don’t know how to keep this happy face a bit more stable, and that would definitely be an improvement to make for next time. The other complication is that I wasn’t able to figure out how to make the sound only begin with a button rather than anytime the circuit is plugged in.


For smiley face:

-Goggly eyes



-Something to resemble hair/nose

For instrument:


-Alligator clips


-100k resistor

-Touch pot



Attached is my code, my schematic, and a video of my instrument.


post #7

For this assignment, we had to create a simple musical instrument. I used a buzzer, an LDR, and an LED light (to give it a party vibe). According to the amount of light the LDR is taking in, the buzzer will sound or not. Attached is my code, my schematic, and a video of the circuit. I used help from this tutorial:



post #6

For the following assignment, we had to find a way to create a circuit using a button, a buzzer, and a servo motor. My circuit will begin when you click the button, the buzzer will produce (a rather annoying) tune, and the servo motor will move. Attached is my code and my schematic. 

post #5

For this assignment, we had to explore and play around with a servo and an LDR. When I first tried the Arduino tutorial code in order to see how the servo worked… it didn’t work. My servo was making a sound like it was functioning, but the spinny part wasn’t spinning. Then I realized that I had plugged the wrong wires into the + and – part of the servo, and when I changed it, it began working. The code utilized for this can be found on: 


The second part of the assignment was to use an LDR in order to move the Arduino according to brightness or darkness. The code I used was the following. Attached is a video of the result and the schematic. I found help by utilizing the following website: 




post #4

  1. Fade versus Fading

For this assignment, we had to analyze the differences between Fade and Fading. Both of these functions simply make an LED fade in and fade out. When you look at the circuit, it seems like they are doing the exact same thing. However, when analyzing the code, the difference between them becomes very clear. For Fade, only one if statement is used in void loop(), whereas Fading utilizes two loops.

I utilized the following items:

1×330 resistor





Attached are pictures of the different codes for Fade and Fading from the Arduino Tutorials. Also, a picture of the code which printed values of the following: high, low, A0, and LED_BUILTIN.

  1. Blink without delay

Here, the code is also from the Arduino, but by adding a Serial-print() and Serialprintl() you can actually see the changes. This works by identifying the difference in milliseconds between each blink.

The code is as follows:


Blink without Delay

Turns on and off a light emitting diode (LED) connected to a digital pin,
without using the delay() function. This means that other code can run at the
same time without being interrupted by the LED code.

The circuit:
– Use the onboard LED.
– Note: Most Arduinos have an on-board LED you can control. On the UNO, MEGA
and ZERO it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN
is set to the correct LED pin independent of which board is used.
If you want to know what pin the on-board LED is connected to on your
Arduino model, check the Technical Specs of your board at:

created 2005
by David A. Mellis
modified 8 Feb 2010
by Paul Stoffregen
modified 11 Nov 2013
by Scott Fitzgerald
modified 9 Jan 2017
by Arturo Guadalupi

This example code is in the public domain.

// constants won’t change. Used here to set a pin number:
const int ledPin = LED_BUILTIN;// the number of the LED pin

// Variables will change:
int ledState = LOW; // ledState used to set the LED

// Generally, you should use “unsigned long” for variables that hold time
// The value will quickly become too large for an int to store
unsigned long previousMillis = 0; // will store last time LED was updated

// constants won’t change:
const long interval = 1000; // interval at which to blink (milliseconds)

void setup() {
// set the digital pin as output:
pinMode(ledPin, OUTPUT);
Serial.begin (9600);

void loop() {
// here is where you’d put code that needs to be running all the time.

// check to see if it’s time to blink the LED; that is, if the difference
// between the current time and last time you blinked the LED is bigger than
// the interval at which you want to blink the LED.
unsigned long currentMillis = millis();
Serial.print (“Current Milisecond: “);
Serial.println (currentMillis);

if (currentMillis – previousMillis >= interval) {
// save the last time you blinked the LED
Serial.print (“Previous Millisecond will now be: “);
previousMillis = currentMillis;

// if the LED is off turn it on and vice-versa:
if (ledState == LOW) {
ledState = HIGH;
} else {
ledState = LOW;

// set the LED with the ledState of the variable:
digitalWrite(ledPin, ledState);

post #3



For this circuit, we had to create a analog code and a loop code. I used two resistors (330), two LEDs (one red one yellow), three wires, breadboard, and the redboard battery. The idea of this exercise was to create a fade in fade out effect. For the red LED, I coded in setup () and for the yellow LED I coded in loop (). This made the red LED increase in brightness, then decrease in brightness, and stop. However, the yellow LED kept this behavior going due to the loop. Attached is my code, my schematic, and a video of the circuit.


int red = 11; // LED 1
int yellow = 10; // LED 2


void setup() {
// put your setup code here, to run once:

analogWrite (red, 0);
delay(200); // wait
analogWrite (red, 75); // gets bright
delay(200); // wait
analogWrite (red, 175); //gets brighter
delay (200); // wait
analogWrite(red, 225); // gets brightest
delay (200); //wait

//then do the opposite thing

analogWrite (red, 225); //brightest
delay (200); //dims
analogWrite (red, 175); //brightness is lower
delay (200); //dims
analogWrite (red, 75); //brightness lowers
delay (200); //dims
analogWrite (red, 0); //nothing
delay (200); //end of red light


void loop() {
//loop is same idea as above but will keep loopin
analogWrite (yellow, 0);
analogWrite (yellow, 75);
analogWrite (yellow, 175);
analogWrite (yellow, 225);
delay (100);

//opposite thing

analogWrite (yellow, 225);
delay (100);
analogWrite (yellow, 175);
delay (100);
analogWrite (yellow, 75);
delay (100);
analogWrite (yellow, 0);
delay (100);


post #2

For this circuit, I used three LEDs and one LDR. What I tried to do was for one of the LEDs to always be on, one to only turn on when the LDR was covered, and one to blink when the LDR was covered. In my Arduino code, I made it so that the first LED would simply always be on, the second was coded so that if the ldrstatus was less than 400 then the LED would turn on, and off if it was above 400, and for the final one I made a blink. To do this I just coded for the LED to turn on when the ldrstatus was less than 400, a delay of 500, then make the LED low, and another delay, and so on. Attached to the post are two images of my circuit working, my schematic (which is probably wrong) and my code in Arduino.