Martin - Interactive Art
Hi, I am studying Digital Media in Germany. This fall i am attending an exchange Semester in Seoul at SKKU University.
Donnerstag, 17. Dezember 2015
Mittwoch, 25. November 2015
Project Update!
![]() |
| Interface Concept and current State |
I updatet the functions for the display. First of all the code now is much more performant. The tft function took a lot of performance so I had to reduce this to a minimun.
Moreover I included touch functions now. The two bars on the lower site of the screen can adjust the alarm time by dragging the point to the desired alarm.
By triggering the lever as in the video you can activate or deactive the alarm variable. This triggers the green output icon on the screen
By triggering the lever as in the video you can activate or deactive the alarm variable. This triggers the green output icon on the screen
I replaced the prototype variables for minutes, hours and seconds with real function calls since I have a working clock now that delivers the correct time data.
Also i implemented a placeholder alarm.
What's left to do is:
-updating and bugfixing the alarm procedure
-adding buttons to deactive the alarm and process their input values
-bugfixing everything and tidying up the code
Sonntag, 22. November 2015
Project Update!
Code:
-Alarm Function 100%
-Time Functions 20%
-Draw Interface Functions 85%
-Touch Screen and Collission Detection Function (for Buttons) 30%
-Generating and processing alarm array 100%
-Input Button Functions 0%
Hardware:
-Clock connected 0% (Placeholder variables atm)
-Display Connected 100%
-Touch Function connected 100%
-On/Off Switch connected 100%
-Sound Output connected 0%
-Buttons connected 0%
-Final product 20%
-Alarm Function 100%
-Time Functions 20%
-Draw Interface Functions 85%
-Touch Screen and Collission Detection Function (for Buttons) 30%
-Generating and processing alarm array 100%
-Input Button Functions 0%
Hardware:
-Clock connected 0% (Placeholder variables atm)
-Display Connected 100%
-Touch Function connected 100%
-On/Off Switch connected 100%
-Sound Output connected 0%
-Buttons connected 0%
-Final product 20%
class Button { int posX, posY, sizeX, sizeY; boolean isCollission, hasBorder; String text; public: void init( String text, int posX, int posY, int sizeX, int sizeY, boolean hasBorder ) { this->text = text; this->posX = posX; this->posY = posY; this->sizeX = sizeX; this->sizeY = sizeY; this->hasBorder = hasBorder; isCollission = false; } int getX() { return posX; } int getY() { return posY; } int getWidth() { return sizeX; } int getHeight() { return sizeY; } String getText() { return text; } boolean getBorder() { return hasBorder; } };
#include <Adafruit_TFTLCD.h> #include <Adafruit_GFX.h> #include "Button.h" #define LCD_CS A3 #define LCD_CD A2 #define LCD_WR A1 #define LCD_RD A0 #define LCD_RESET A4 #define white 0x0000 #define BLUE 0x001F #define RED 0xF800 #define GREEN 0x07E0 #define CYAN 0x07FF #define MAGENTA 0xF81F #define YELLOW 0xFFE0 #define WHITE 0xFFFF Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET); int timeHours = 10; int timeMinutes = 20; int timeSeconds = 0; int displayMode = 0; int tick = 0; int alarmIteration = 0; int alarmSize = 6; int alarmCode[6]; boolean alarmIsEnabled = true; boolean alarmIsPlaying = false; // set to false int alarmHour = 9; int alarmMinute = 40; Button button[14]; void setup(void) { Serial.begin(9600); pinMode(0, INPUT); tft.reset(); uint16_t identifier = tft.readID(); tft.begin(identifier); tft.setRotation(1); tft.fillScreen(white); // Generate Alarm. The alarm is a randomly generated array. // On each Index a number between 1 and 4 is stored. // Later the beeps will be generated in a sequence resulting // as an output of iterating through this array. for (int i = 0; i < alarmSize; i++) { int number = floor(random(1,5)); alarmCode[i] = number; Serial.println(number); } //Generate Buttons button[0].init("1",310,50,40,40,true); button[1].init("2",360,50,40,40,true); button[2].init("3",410,50,40,40,true); button[3].init("4",310,100,40,40,true); button[4].init("5",360,100,40,40,true); button[5].init("6",410,100,40,40,true); button[6].init("7",310,150,40,40,true); button[7].init("8",360,150,40,40,true); button[8].init("9",410,150,40,40,true); button[9].init("<",310,200,40,40,true); button[10].init("Ok",360,200,40,40,true); button[11].init("Cancel",370,287,100,30,false); button[12].init("Set Alarm",40,287,135,30,false); button[13].init("alarm on",290,30,55,18,true); } void loop(void) { updateTime(); mechanics(); render(); } void updateTime() { timeSeconds = int( floor( millis()/1000 ) ) % 60; } String timeToAlarm() { int currentTimeValue = timeHours * 60 + timeMinutes; int alarmTimeValue = alarmHour * 60 + alarmMinute; int returnedTime; if (currentTimeValue < alarmTimeValue) { returnedTime = alarmTimeValue - currentTimeValue; } else { returnedTime = 24*60 - ( alarmTimeValue - currentTimeValue ); } return String( int( floor( returnedTime/60 ) ) )+"h "+String( returnedTime%60 )+"m"; } void render() { switch (displayMode) { case 0: // String(timeHours)+":"+String(timeMinutes)+":"+String(textSeconds) tft.setCursor(40, 30); tft.setTextColor(WHITE,white); tft.setTextSize(5); if (timeHours < 10) tft.print('0'); tft.print(timeHours); tft.print(":"); if (timeMinutes < 10) tft.print('0'); tft.print(timeMinutes); tft.print(":"); if (timeSeconds < 10) tft.print('0'); tft.print(timeSeconds); tft.setCursor(40, 85); tft.setTextColor(RED,white); tft.setTextSize(2); tft.print("Alarm Time: "); tft.setTextColor(WHITE,white); tft.setTextSize(2); if (alarmHour < 10) tft.print('0'); tft.print(alarmHour); tft.print(":"); if (alarmMinute < 10) tft.print('0'); tft.print(alarmMinute); tft.setCursor(40, 105); tft.setTextColor(RED,white); tft.setTextSize(2); tft.print("Time Left: "); tft.setTextColor(WHITE,white); tft.setTextSize(2); tft.print(timeToAlarm()); tft.setTextSize(2); tft.setTextColor(RED,white); tft.setCursor( button[12].getX() + 15, button[12].getY() + 5 ); tft.print( button[12].getText() ); if( alarmIsEnabled ) { tft.setTextSize(1); tft.drawRect( button[13].getX(), button[13].getY(), button[13].getWidth(), button[13].getHeight(), GREEN ); tft.setTextColor(GREEN,white); tft.setCursor( button[13].getX() + 4, button[13].getY() + 5 ); tft.print( button[13].getText() ); } else { tft.fillRect( button[13].getX(), button[13].getY(), button[13].getWidth(), button[13].getHeight(), white ); } break; case 1: tft.setTextSize(2); for(int i = 0; i < 12; i++) { if( button[i].getText() == "Cancel" ) { tft.setTextColor(RED,white); } else { tft.setTextColor(WHITE,white); } if(button[i].getBorder() ) { tft.drawRect( button[i].getX(), button[i].getY(), button[i].getWidth(), button[i].getHeight(), WHITE ); } if( button[i].getText() == "Ok" ) { tft.setCursor( button[i].getX() + 11, button[i].getY() + 14 ); } else if( button[i].getText() == "Cancel" ) { tft.setCursor( button[i].getX() + 15, button[i].getY() + 5 ); } else { tft.setCursor( button[i].getX() + 15, button[i].getY() + 14 ); } tft.print( button[i].getText() ); } break; } } void mechanics() { if(alarmIsPlaying) { playAlarm(); } if( analogRead(A5) == 0 ) { alarmIsEnabled = true; } if( analogRead(A5) > 0 ) { alarmIsEnabled = false; } Serial.println( alarmIsEnabled ); } void setAlarm(int h, int m) { alarmHour = h; alarmMinute = m; } void triggerAlarm() { // The alarm is triggered when the hour equals "alarmHour", minute // equals "alarmMinute" and the second is zero. "Second" must be 0! // This function's if statement is being entered for 1 minute. // So, if the user disables the alarm within 1min the function would // be called again and the alarm would start all over again. /*if( hour() == alarmHour && minute() == alarmMinute && alarmIsEnabled && second() == 0 ) { alarmIsPlaying = true; }*/ } void disableAlarm() { // reset some variables alarmIteration = 0; } void playAlarm() { if( millis() - tick > 300 ) { // the alarmCode array is iterated through. a tone should be played // after every 300ms. The tone lasts for 250ms with a puase of 50ms // the frequency between each tone differs in 1000hertz. switch (alarmCode[alarmIteration]) { case 1: tone(11, 1000, 250); break; case 2: tone(11, 2000, 250); break; case 3: tone(11, 3000, 250); break; case 4: tone(11, 4000, 250); break; } // alarmIteration is the Iterator because we cannot use a for-loop // it is set to zero, after the alarmSequence has finished. // after that, there should be a 1 second pause before the alarm // is played again. alarmIteration++; if( alarmIteration > alarmSize-1 ) { alarmIteration = 0; tick = millis() + 1000; } else { tick = millis(); } } }
Sonntag, 8. November 2015
Interactive Art - Week 8
Donnerstag, 29. Oktober 2015
Interactive Art - Homework 7
Optitrack Motion Capture Sensor
http://www.optitrack.com/
The Optitrack Sensors capture motions. This can be an interesting feature for several projects. Unfortuantelly the sensors are not affordable for every students:
The price starts with about 500 USD for the Flex Series.
The results are outstanding if there the technical expertise is provided.
Here is an example video where Optitrack Sensors come to use.
The sensors track the points on the subjects face. On software-side this points are converted into a 3d model to which an animated texture is applied.
This model is projected back on the face. While moving the head in a certain direction, the 3d shape begins to change and so does the projection back onto the face.
The effect is really cool and has some kind of augmented reality feeling!
MyvIdea:
Glasses that project 3d objects into real environment. If you wear these glasses there is made a 2d projection on each of the two glasses which appears in 3d.
An example how it works:
If you see a cube, normally the images a human sees are 2-dimensional. The only thing that creates depth and lets images we see look 3-dimensional is the fact, that we see an object from two sides actually, because we have two eyes, which are not at the same point.
Spoken in mathematical formulars: If you have 2 points (our eyes) and an angle (errated by our brain of a comparison of the images of the object we see from two sides) of a triangle you can errate the distance to the third point (the object we actually see) of the triangle.
So we see two images of maybe an objects like this cube from two positions.
The depth or in this case 3d look is created by our brain which combines this two images.
What finally is created is a 3d image of the scene.
What basicially the glass is projecting an 3d objects on each of the two glasses.
-The angle and size of each projection of the object defines its distance to the viewer. Bigger angle = its nearer
-The position on the glasses defines its angle to the viewer
On this way, if the viever wears the glasses he will see 3d objects in real space. They will look like if they were part of the real world
Samstag, 24. Oktober 2015
Interactive Art - Homework 6
A simple concept of a help/support button. If someone presses the button somewhere else (maybe at a security office etc) an alarm light blinks.
The power circuit:
int led1 = 7; int led2 = 6; int led3 = 5; int tick = 0; int inputPin = 13; void setup() { pinMode(led1, OUTPUT); pinMode(led2, OUTPUT); pinMode(led3, OUTPUT); pinMode(inputPin, INPUT); } void loop() { if (digitalRead(inputPin) == HIGH) { digitalWrite(led1, LOW); digitalWrite(led2, LOW); digitalWrite(led3, LOW); } else { blinks(); } } void blinks() { digitalWrite(led1, HIGH); digitalWrite(led2, LOW); digitalWrite(led3, LOW); delay(50); digitalWrite(led1, LOW); digitalWrite(led2, HIGH); digitalWrite(led3, LOW); delay(50); digitalWrite(led1, LOW); digitalWrite(led2, LOW); digitalWrite(led3, HIGH); delay(50); }
Abonnieren
Kommentare (Atom)









