For my self-potrait, I tried to keep it simple by using pretty much only the basic shapes. Even so, I spent so much time going down Processing’s reference page to try and get an understanding of how each shaped worked (I also found my favourite shape — the rounded rectangle). For me, the hardest part of this assignment was calculating exactly where my shapes should go for the best overlap, but even with my calculations, a lot of it still came down to trial and error and I think even now, my nose doesn’t look exactly like I want it to. I’m pretty proud of the for() loop I used to draw my hair, though.
For this week’s assignment, I took the idea of “how a human moves” and decided to add a kind of comical, cartoonish spin. Inspired by how much my head was metaphorically spinning during my Discrete Math quiz, I decided to bring the metaphor to life. Combining a motor and a skull eraser my friend gave me last year, I created a spinning head.
I had just one issue: the hole at the base of the skull is too big for the motor and, at first, I tried to use paper to narrow it down, but the motor would just slide against the paper and not cause any motion. Now, I’ve resorted to just holding the motor at an angle.
After spending the whole weekend racking my brain for ideas and having none come, I was inspired after strumming on my guitar a bit. I’d just make something that makes noise like last week’s assignment. I decided to revisit my last assignment and make it a bit more playful. So, welcome to round 3 of piano mania. This time, I decided to make a piano with a bit of an attitude.
You’re probably reading this post and saying “What? A piano? Again? Why does she keep doing this???” The exasperation is understood and not misplaced — but hear me out.
To arrive at this week’s assignment, I expanded upon my previous instrument idea. Instead of the 3 buttons for the 3 notes necessary to play Mary Had a Little Lamb, I decided to have 7 buttons to produce the entire range of notes. And since no piano is complete without a couple octaves, I added a flex sensor which serves as a sort of “switch” between octaves. This also adds a bit of difficulty and fun(?) to the instrument, as the musician has to keep the sensor bent while playing the notes.
For this assignment, I decided to make a mini-keyboard of sorts with just the right amount of keys and the right notes to play Mary Had a Little Lamb. Using my blunder from last class where I had the pattern repeat even during the button press instead of just at the edges, I was able to get the notes to sustain over the button press. I ran into some problems during my first test run where a tone would play regardless of button press, but I just re-examined my board and realized that I had my resistors hooked up to 5V and not ground. For further implementations, I’m thinking of adding like some sort of octave shift if the button is held long enough.
For this week’s assignment, I created a sequence where the tone (a very bad rendition of The Itsy Bitsy Spider) would play on the buzzer and then the servo would do a little dance by moving to 90 degrees, then 180, then to 10. My biggest challenge was getting reading and getting a good enough understanding of how the tones worked so that I could play something nice enough and, even right now, it’s not all that nice. Also, I had a bit of trouble with getting my push button to work exactly as I wanted it to, but I think it’s working well enough right now.
Inspired by nothing other than IT and my own very real fear of the dark, I decided to make my servo move the full 180 degrees in the dark, only 70 degrees in medium light and merely 10 degrees in bright light. My ideal endgame is a small robot that will run around in the dark, but right now I’m just trying to get my servo on.
1: Fade vs. Fading
Functionally, both Fade and Fading accomplish the same thing. They both cause a LED connected to Pin 9 to fade in and out. The main difference between them lies in the underlying code. In Fade, only a single if statement is used to control the LED’s brightness. The if-statement checks if the brightness is between 0 and 255 and changes the sign of fadeAmount to keep the brightness within those bounds. While the brightness is under 255, fadeAmount is positive and continues to increase the brightness. When the brightness hits 255, fadeAmount becomes negative and decreases the brightness until it’s 0.
For this assignment, we were to use two LEDs and analogWrite() + delays to create a pattern of fading brightness. Even further, we were to control one LED in setup() and one in loop(). To examine the different behaviours of the loops, I wrote the same fade algorithm in both functions [setup() and loop()]. However, the LED controlled by setup() only faded once while the other in loop() fades indefinitely, starting after the LED controlled by setup stops fading.
My main goal for my circuit was to combine everything we learnt in class on Wednesday. I think I went a bit overboard on my circuit’s behaviors as evidenced by very long nested-if statements. Because I like reading, I thought it would be cool to make a circuit that produces a green-light when there’s enough light in the room to be reading, a yellow light when the light in the room is getting kind of low, and a red light when the light in the room is definitely a bit too low. Then, just because I wanted to make my LEDs blink, I made it so that the green light would blink when the light in the room is nearing yellow values and that the red light would blink when the light in the room was beyond a bit too low (read as: dark).