Month: February 2019
A heart falling in love – heart beat generator – love story part 1
This valentine’s day, save money on chocolates and flowers and make people fall in love with you with a simple button.
For this project, I used 10 LED lights, and put them into a piece of poster board in the shape of heart. I used different circuits for each LED as well as the button. At first I tried to solder the LEDs to the wires before poking them into the surface, but then found that this made the LEDs not stand up straight and move around due to the large hole. Therefore I decided to solder the LEDs after having put them into the board. I soldered the power and ground side of each LED separately, therefore using a total of 20 wires for the soldering. I considered having the button on the board too but decided that I want it to be eventually framed and still be able to use the button, so it would be better to have it separate. In order to make them fixed on the board, I glue gunned the LEDs from the back on to the board.
In order to fulfill the condition of having more than one input or output, I had 3 different speeds, to replicate the heart beat getting faster (this is how you know the button has made your special someone fall in love with you, their heart beats faster when you are around 😉 ) as well as an on/off option.
I used the blink code, firstly adjusting it to make it blink like a heartbeat (with a short delay and then a longer delay), then using for loop to make all the LEDs do the same action at the same time. I used index, with {0, 200, 100, 30}; as the delays, to make the button increase the speed of and turn on/off the lights.
int ledPin1 = 3; int ledPin2 = 6; int buttonPin = 2; int index = 0; int prevButtonState = LOW; int lowDelay[4] = {0, 200, 100, 30}; unsigned long toggleTime = 0; int triggerInterval = 500; int buzz = 13; // Blink // Turns an LED on for one second, then off for one second, repeatedly. // // 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: // https://www.arduino.cc/en/Main/Products // // modified 8 May 2014 // by Scott Fitzgerald // modified 2 Sep 2016 // by Arturo Guadalupi // modified 8 Sep 2016 // by Colby Newman // // This example code is in the public domain. // // http://www.arduino.cc/en/Tutorial/Blink //*/ // the setup function runs once when you press reset or power the board void setup() { // initialize digital pin LED_BUILTIN as an output. for (int i=3; i<=12;i++){ pinMode(i,OUTPUT); } pinMode (buttonPin, INPUT); Serial.begin(9600); } // the loop function runs over and over again forever void loop() { int currentButtonState = digitalRead(buttonPin); int knobValue = analogRead(A0); Serial.println(knobValue); if (knobValue <50) { index = 0; } if (currentButtonState == HIGH && prevButtonState == LOW) { index = index + 1; if(index >= 4){ index = 0; } // Serial.println(index); } if(index != 0){ for (int i = 3;i<=12;i=i+1){ digitalWrite(i, HIGH); } delay(100); for (int i = 3;i<=12;i+=1){ digitalWrite(i, LOW); } delay(lowDelay[index]); for (int i = 3;i<=12;i++){ digitalWrite(i, HIGH); } delay(100); for (int i = 3;i<=12;i++){ digitalWrite(i, HIGH); } delay(1000); for (int i = 3;i<=12;i++){ digitalWrite(i, LOW); } delay(lowDelay[index]); for (int i = 3;i<=12;i++){ digitalWrite(i, HIGH); } delay(100); for (int i = 3;i<=12;i++){ digitalWrite(i, HIGH); } } else { for (int i = 3;i<=12;i++){ digitalWrite(i, LOW); } } prevButtonState = currentButtonState; // for (int i = 3;i<=12;i++){ // if (knobValue == 0) // { // digitalWrite(i,LOW); // } // } int LIGHT = analogRead(13); if (LIGHT < 100){ tone(buzz, 3000, 50); } }
Reading response 1
Its interesting to understand the definition of interactivity and that not everything that we interact (react) to is interactive. The writer says that a cyclic process in which two actors alternately listen, think,and speak is an interaction. This is interesting because when asked in one of the first lessons to go out of the class and find things that are interactive, most of us came up with things that would, according to this text, not actually be interactive. For example we were going to initially choose a bench/table that several of us thought was interactive, due to need for an even number of people to be sat on it to balance it and its ability to spin, however Crawford would likely disagree. However we ended up choosing the coffee machine, which I am not entirely sure if Crawford would disagree with or not, as when we listen (seeing the options), think, and speak (choosing coffee), and the machine listens (to our request input), thinks (processes it), and speaks (prepares chosen coffee), this seems to me to be interactive due to Crawford’s logic as well.
Hey throw that ball in this thing
Boy was I in for a treat this morning when I strolled on down to the IM lab to finish my project. I was sure it would only take five or so minutes. I just needed to add some parts that I didn’t have in my room.
Nope. Definitely not. I got to the lab and, half an hour later, had discarded my entire project. Hours spent in my room, fiddling with compelx codes and multiple inputs and outputs, all gone. So, yeah, I don’t think this project is exactly what Aaron was looking for with this assignment, but I think I twiddled enough in my room to understand the concepts we needed to grasp.
My original idea was to have my sunglasses come down, as they did before, and then I would snap some finger guns and suddenly, LED lights would come on, blinking “S W A G” in morse code.
Instead, I have this…
#2: Switch with coding
For our second assignment, we were asked to use code within our switch to do something creative with the LED lights. I decided to create a car game of sorts (however, having run of time, it was reduced to a lesser parody).
I coded 3 different LED lights to turn on as a traffic light would. This took a lot of help and I ended up learning new methods I hadn’t used before. I also wanted to attach a button pin to turn the traffic lights on and off which proved to be very difficult.
Lastly, I also wanted lights to turn on once the car touched the finish line – I did this using a simple circuit using foil and without any code.
If I had more time, I would have liked to build a proper traffic light and circuit and also two cars that could actually race.
int red = 2; int yellow = 3; int green = 4; int buttonPin = 5; // boolean variable to keep track of whether our sequence is on or off bool start = false; // variable to keep track of our prevous button state int prevButtonState = LOW; // a very large container of memory used as a variable for numbers that continually increase (Like time) unsigned long triggerTime = 0; // the interval between light changes int interval = 2000; // which light are we currently activating int whichLight = 0; void setup() { pinMode(red, OUTPUT); pinMode(yellow, OUTPUT); pinMode(green, OUTPUT); pinMode(buttonPin, INPUT); Serial.begin(9600); } void loop() { // read our button (switch) int currentButtonState = digitalRead(buttonPin); // if the button is currently being pressed and during the last frame it was not pressed then continue if (currentButtonState == HIGH && prevButtonState == LOW) { // flip start on or off start = !start; // reset our trigger time to the current time so we can trigger immediately triggerTime = millis(); // reset our light sequence to the beginning whichLight = 0; } // if sequence is activated then call changeLights() if (start == true) { changeLights(); } else { // otherwise turn everything off digitalWrite(yellow, LOW); digitalWrite(red, LOW); digitalWrite(green, LOW); } // remember the current button state so we can have a previous button state the next time through loop prevButtonState = currentButtonState; } // the actual sequence of light changes void changeLights() { // boolean to trigger the next light or not, start off by not triggering bool triggerLight = false; // get our current time unsigned long currentMillis = millis(); // if the current time is greater than the time when we should trigger, THEN LET'S TRIGGER! if (currentMillis >= triggerTime) { triggerLight = true; // LET's TRIGGER triggerTime = currentMillis + interval; // reset the trigger time for 2 seconds later } // if we're triggering the next light if (triggerLight == true) { // which light are we on if (whichLight == 0) { // red digitalWrite(red, HIGH); } else if (whichLight == 1) { // yellow digitalWrite(yellow, HIGH); } else if (whichLight == 2) { // green digitalWrite(yellow, LOW); digitalWrite(red, LOW); digitalWrite(green, HIGH); } else if (whichLight == 3) { // then turn everything off start = false; } // increase the sequence to the next light, only to be triggered after the triggerTime == currentTime whichLight = whichLight + 1; } }
Response to Reading #1
Chris Crawford begins the chapter with his own definition of interactivity:
a cyclic process in which two actors alerternaty listen, think, and speak.
I have read his definition of interactivity in another text he wrote and I agree with him and with the degrees of interactivity that he goes on to point in this chapter. Listening, thinking and speaking are all important aspects of an interface. Both sides need to be equal and while I agree with him on a lot of things, I don’t agree with his statement that books and dancing are not interactive. I personally think that you can have types of texts that are interactive and thus the term- hypertext. An example of hypertext could be “The Garden of Forking Paths”. I do, however, agree that movies are not interactive, nevertheless, there has been some progress in producers trying to make films interactive. A good example of that would be Netflix’s Bandersnatch.
Switch v2.0
Greetings.
So during last class we have created a switch (an actual switch, not the button) . I have used this wonderful creation of ours to make a fire (not only fire but any type of) alarm. The program runs the usual to us part of code where the LED is turned on as the button is pressed and turned off as the button is pressed again. Then I have added the piezo buzzer to the circuit. The most challenging part was to differ the frequency of the sound to make it sound like an alarm. I’ve made a while loop that changes the frequency of the buzzer and it turns on like the LED switch. Code is attached bellow and the video will be uploaded later on, after the class presentation.
int buzz = 4; int buttonPin = 2; int ledPin = 3; int ledState = LOW; int prevButtonState = LOW; bool inter = 0; void setup() { pinMode(ledPin, OUTPUT); pinMode(buttonPin, INPUT); Serial.begin(9600); attachInterrupt(0, pin_ISR, CHANGE); } void loop() { int currentButtonState = digitalRead(buttonPin); if (ledState == HIGH) { int i = 100; while (inter && i < 5000) { tone(buzz, i, 5); i++; } } if (currentButtonState == HIGH && prevButtonState == LOW) { if (ledState == HIGH) { ledState = LOW; } else if (ledState == LOW) { ledState = HIGH; } } digitalWrite(ledPin, ledState); prevButtonState = currentButtonState; } void pin_ISR() { Serial.print("h"); delay(100); inter = !inter; }
Response to Interactivity
Chris Crawford’s paper on interactivity was very enlightening. Although I came in understanding the term “interactive”, I was pleasantly surprised that he had to argue/explain to others about what it is because many people confused it with “reaction”. When he mentioned what the difference was between the two, I realized that I also did not have a firm understanding of interaction (based on his definition).
Something interesting that he brought up was about how an interactive product is a weak link in a chain if not all three conditions (listening, speaking, and thinking) are met regardless of how strong the other two links are. It led to think whether that is actually true; does there exist a project that only takes 2/3 of the conditions, but was still able to make it interactive.
Overall, I think the paper was a bit too strict on what qualifies as an interactive piece. I personally think as long as the user can play around with a work piece and get a response out of it, it is interactive. Whatever the work is, the project doesn’t need to have thinking involved (the response does not have to come from thinking).
Dancing Glove
The second assignment was to expand our initial analogue switch and make a program in Arduino that combines more digital inputs and outputs.
Since I kind of needed the shoes used in last week’s switch, I used the very same principle and applied it on a glove that somehow found a way to my suitcase after winter break.
I constructed one aluminium board which was connected to power, while middle finger was programmed as a switch to light the yellow LED up when connected, index finger made the same with the red LED and thumb was programmed to act as a legit switch that turns both LEDs on, or off.
//blinking int ledYellow = 3; int ledRed = 4; int MiddleButtonPin = 2; int MiddleButtonState = LOW; int IndexButtonPin = 5; int IndexButtonState = LOW; //Thumb switch int ThumbButtonPin = 6; int ledYellowState = LOW; int ledRedState = LOW; int prevThumbButtonState = LOW; void setup() { // put your setup code here, to run once: pinMode(ledYellow, OUTPUT); pinMode(ledRed, OUTPUT); pinMode(MiddleButtonPin, INPUT); pinMode(IndexButtonPin, INPUT); pinMode(ThumbButtonPin, INPUT); Serial.begin(9600); } void loop() { // put your main code here, to run repeatedly: //THUMB BUTTON SWITCH ON AND OFF int currentThumbButtonState = digitalRead(ThumbButtonPin); if (currentThumbButtonState == HIGH && prevThumbButtonState == LOW) { if (ledYellowState == HIGH){ ledYellowState = LOW; } else if (ledYellowState == LOW) { ledYellowState = HIGH; } } if (currentThumbButtonState == HIGH && prevThumbButtonState == LOW) { if (ledRedState == HIGH){ ledRedState = LOW; } else if (ledRedState == LOW) { ledRedState = HIGH; } } digitalWrite(ledYellow, ledYellowState); digitalWrite(ledRed, ledRedState); prevThumbButtonState = currentThumbButtonState; //MIDDLEFINGER WITH YELLOW LIGHT INTERACTION MiddleButtonState = digitalRead(MiddleButtonPin); if (MiddleButtonState == HIGH) { digitalWrite(ledYellow, HIGH); } else { digitalWrite(ledYellow, LOW); } //INDEX FINGER WITH RED LIGHT INTERACTION IndexButtonState = digitalRead(IndexButtonPin); if (IndexButtonState == HIGH) { digitalWrite(ledRed, HIGH); } else { digitalWrite(ledRed, LOW); } }
Reaction to Crawford’s Interaction
The field of interactivity is conceptually new and yet to be explored. And, as usual, hand in hand with everything new comes a lot of disagreement too. However, Crawford gracefully, with a lot of humour, manages to draw some crucial distinctions and definitions to help us understand what interactivity actually is and why is it important. He brings up and redefines different situations in the way I never thought of before: a falling branch, book, fridge or theatre play are examples used to demonstrate the difference between reaction and interaction and how these terms get very mixed up and misused.
Right when I was strongly disagreeing with what he was arguing in terms of the interactivity of the fridge, he brought up a sensible idea of levels of interactivity. Crawford made a dialogue analogy as an example in which all of the elements have to work 100% in order to make it successfully work, and through which he managed to convince me that the dialogue itself is the core essence of interactivity. This really made me shift my way of thinking about interaction. Yet, to be fair, there was not much theoretical foundation to begin with, as I often take the art of interaction for granted and only question it when it fails (automatic doors all around the campus, I’m looking at you).
What also draw my attention was the recognition of graphic design and the role it plays in the dialogue of interaction. I really agreed with what Crawford said about graphic design and interaction design NOT being two separate steps. I feel like that both sides fail to adapt to the pace the world is evolving in, and sticking to the old categorisation prevents them from recognising that the field of graphic design and interactive design is inevitably merging.
Overall, I truly enjoyed reading Crawford’s witty piece, thanks to which I’m getting more and more excited to explore the field of interaction from the practical, creator’s side of it.