HAIKU-NATOR はいく-NATOR
(C) 2019 by CGF
HAIKU-NATOR by CGF
what is a
HAIKU?
A Haiku is a very short poem, originally from the ancient Japanese poetry, divided in three different phrases, and typically characterized by three qualities; //juxtaposition of two images and an action //17 syllables (5+7+5) //a seasonal/temporal reference
HAIKU-NATOR by CGF
HAIKU-NATOR by CGF
“Pikachu is cool you study and don’t rest pineapples ar good”
“please don’t die today a person who has no friends i just want to say”
“natural leader i am hiding forever so heartbreaking”
HAIKU-NATOR by CGF
HAIKU-NATOR by CGF
“under a big stone a baby daddy a friend what is a Haiku”
“business is hard you love to torture your friends please don´t die today”
“i just want o say you should never post again the thing that you like”
HAIKU-NATOR by CGF
HAIKU-NATOR by CGF
what is a
HAIKU-NATOR?
well... I’m not sure about that... it’s a small device for your ¿desktop? that will create Haikus for you anytime that you feel you would need one. it’s a tiny techno-garden, a piece of artifitial nature, a technological element and a light source as well... it’s a completelly useless and nice gadget that will provide you with some wisdom and joy whenever you feel like.
HAIKU-NATOR HAIKUNATOR by CGF
HAIKU-NATOR by CGF
what is inside the
HAIKU-NATOR?
the core of the HAIKU-NATOR is an Arduino Nano board, connected to a LCD screen, well known for being the screen used by Nokia on the legendary model 5110 and above. also a buzzer is used to play some retro melodies, as well as a button to interact with the device. the HAIKU-NATOR is powered via an USB cable, that can be attached to any laptop/PC or powerbank.
HAIKU-NATOR by CGF
HAIKU-NATOR by CGF
what is inside the
HAIKU-NATOR? //CIRCUIT
HAIKU-NATOR by CGF
HAIKU-NATOR by CGF
what is inside the
HAIKU-NATOR? //CODE
char *interface[] = { “O O”, “* *”, “_ _”, “|---|”, “ 3 “, }; char *conversation[] = { “HEY U!!!”, “what a”, “WONDERFUL day...”, “let me search”, “through my”, “database...”, “I will create”, “a HAIKU just”, “for u...”, “WANT ANOTHER ONE?”, “then press the”, “button!!!”, “i’ll see u next time”, “u need another”, “HAIKU! ;)”, };
“more than a husband”, “religion class rocks”, “so heartbreaking”, “pineapples are good”, “Pikachu is cool”, “natural leader”, “5 syllables here”,
};
char *haiku2[] = { “if u pls let m finish”, “enthusiasts by nature”, “nothing but words,poetic?”, “monday s a day to die”, “i am hiding forever”, “u should nvr post again”, “a prson who hs no friends”, “a raging,feral,creature”, “another contribution”, “a baby daddy a friend”, “apples r very yummy”, “lov to trture ur friends”, “hes th coolest of all”, “passionate educator”, “7 more syllables here”, “u study & dont rest”, “chipotle oh how i lov”, “i got u som strawbrries”, };
char *haiku1[] = { “pls don’t die today”, “i just want to say”, “what is a HAIKU”, “business is hard”, “for all the pizzas”, “under a big stone”, “this is a bad post”, “a stunning singer”, “an unstable lunatic”, “the thing that u like”, “calm rain sad quiet”, “beautiful flowers”,
HAIKU-NATOR by CGF
HAIKU-NATOR by CGF #include “arrays.h” #include “pitches.h” #include <LCD5110_Graph.h> LCD5110 myGLCD(8, 9, 10, 12, 11);
// LCD pins setup
extern unsigned char TinyFont[]; extern unsigned char SmallFont[];
// LCD fonts
int button = 6; ///////////////////////////////////////////// VOID SETUP void setup() { myGLCD.InitLCD(); myGLCD.setContrast(65); myGLCD.setFont(TinyFont); randomSeed(analogRead(0)); } ////////////////////////////////////////////// VOID LOOP void loop() { background(); waitButton(); myGLCD.invert(false); circles(100, 14); wakeUpMelody(); delay(2000); face1(2000); face2(500); face1(2000); face2(500); face1(1000); myGLCD.clrScr();
delay(1000); myGLCD.setFont(SmallFont); myGLCD.print(conversation[0], CENTER, 10); myGLCD.setFont(TinyFont); myGLCD.print(conversation[1], CENTER, 20); myGLCD.print(conversation[2], CENTER, 30); myGLCD.update(); delay(4000); face3(4000); myGLCD.clrScr(); myGLCD.setFont(SmallFont); myGLCD.print(conversation[3], CENTER, 10); myGLCD.print(conversation[4], CENTER, 20); myGLCD.print(conversation[5], CENTER, 30); myGLCD.update(); delay(4000); myGLCD.clrScr(); myGLCD.setFont(SmallFont); myGLCD.print(conversation[6], CENTER, 10); myGLCD.print(conversation[7], CENTER, 20); myGLCD.print(conversation[8], CENTER, 30); myGLCD.update(); delay(4000); lines(20); delay(1000); haikuCreation(); haikuFinal(); delay(2000); myGLCD.clrScr(); myGLCD.setFont(TinyFont); myGLCD.print(conversation[9], CENTER, 10); myGLCD.print(conversation[10], CENTER, 20); myGLCD.print(conversation[11], CENTER, 30); myGLCD.update();
HAIKU-NATOR by CGF
HAIKU-NATOR by CGF byte buttonState = getButtonState(button); if (buttonState != 0) { if (buttonState == 1) { lines(20);
}
}
delay(1000); haikuCreation(); haikuFinal(); delay(5000);
myGLCD.clrScr(); myGLCD.setFont(TinyFont); myGLCD.print(conversation[12], CENTER, 10); myGLCD.print(conversation[13], CENTER, 20); myGLCD.setFont(SmallFont); myGLCD.print(conversation[14], CENTER, 30); myGLCD.update(); delay(6000); face4(1000);
} ////////////////////////////////////////////// FUNCTIONS ////////////////////////////////////////////// FACES void face1(int del) { myGLCD.setFont(SmallFont); myGLCD.clrScr(); myGLCD.drawCircle(41, 23, 23); myGLCD.print(interface[0], CENTER, 12); myGLCD.print(interface[3], CENTER, 30); myGLCD.update(); tone(7, NOTE_D5, 20); delay(del); myGLCD.clrScr(); myGLCD.setFont(TinyFont); } void face2(int del) {
}
myGLCD.setFont(SmallFont); myGLCD.clrScr(); myGLCD.drawCircle(41, 23, 23); myGLCD.print(interface[2], CENTER, 12); myGLCD.print(interface[3], CENTER, 30); myGLCD.update(); tone(7, NOTE_D5, 20); delay(del); myGLCD.clrScr(); myGLCD.setFont(TinyFont);
void face3(int del) { myGLCD.setFont(SmallFont); myGLCD.clrScr(); myGLCD.drawCircle(41, 23, 23); myGLCD.print(interface[1], CENTER, 12); myGLCD.print(interface[4], CENTER, 30); myGLCD.update(); tone(7, NOTE_D5, 20); delay(del); myGLCD.clrScr(); myGLCD.setFont(TinyFont); } void face4(int del) { myGLCD.setFont(SmallFont); myGLCD.clrScr(); myGLCD.drawCircle(41, 23, 23); myGLCD.print(interface[0], CENTER, 12); myGLCD.print(interface[4], CENTER, 30); myGLCD.update(); delay(del); myGLCD.clrScr(); myGLCD.setFont(TinyFont); } /////////////////////////////////////////////// GRAPHICS void background() { myGLCD.clrScr();
HAIKU-NATOR by CGF
HAIKU-NATOR by CGF myGLCD.invert(true); myGLCD.print(“HAIKU”, CENTER, 16); myGLCD.print(“NATOR”, CENTER, 23); myGLCD.drawRect(28, 12, 56, 32); for (int i = 0; i < 6; i++) { myGLCD.drawLine(57, 18 + (i * 2), 83 - (i * 3), 18 + (i * 2)); myGLCD.drawLine((i * 3), 28 - (i * 2), 28, 28 - (i * 2)); } myGLCD.setFont(TinyFont); myGLCD.print(“(C)2019 by”, CENTER, 36); myGLCD.print(“CGF”, CENTER, 42); myGLCD.update(); } void circles(int del, int num) { myGLCD.clrScr(); for (int i = 0; i < num; i++) { myGLCD.drawCircle(41, 23, i * 3); myGLCD.update(); tone(7, NOTE_D5, 20); delay(del); } } void lines (int del) { myGLCD.clrScr(); for (int i = 0; i < 48; i = i + 2) { myGLCD.drawLine(0, i, 83, 47 - i); delay(del); myGLCD.update(); } for (int i = 83; i >= 0; i = i - 2) { myGLCD.drawLine(i, 0, 83 - i, 47); delay(del); myGLCD.update();
}
}
//////////////////////////////////////////////// BUTTONS byte getButtonState(byte but1) { long timer = millis(); while ((digitalRead(but1) == LOW) && ((millis() timer) < 10000)); {} if (digitalRead(but1) == HIGH && (millis() - timer) <= 10000) { return 1; } else { return 0; } } void waitButton() { while (digitalRead(button) == LOW); {} } //////////////////////////////////////////////// HAIKUS void haikuCreation() { myGLCD.setFont(TinyFont); for (int i = 0; i < 20; i++) { myGLCD.clrScr(); myGLCD.print(haiku1[random(18)], CENTER, 10); myGLCD.print(haiku2[random(17)], CENTER, 20); myGLCD.print(haiku1[random(18)], CENTER, 30); myGLCD.update(); tone(7, NOTE_D5, 20); delay(80); } } void haikuFinal() { myGLCD.clrScr(); myGLCD.print(haiku1[random(18)], CENTER, 10); myGLCD.print(haiku2[random(17)], CENTER, 20);
HAIKU-NATOR by CGF
HAIKU-NATOR by CGF myGLCD.print(haiku1[random(18)], CENTER, 30); myGLCD.update(); playMelody();
} ////////////////////////////////////////////// MELODIES void wakeUpMelody() { tone(7, NOTE_D5, 800); delay(200); tone(7, NOTE_F5, 800); delay(200); tone(7, NOTE_D6, 800); } void playMelody() { int melody[] = { // notes in the melody (frequences stored in the pitches.h tab) NOTE_D5, NOTE_F5, NOTE_D6, NOTE_D5, NOTE_F5, NOTE_D6, NOTE_E6, NOTE_F6, NOTE_E6, NOTE_F6, NOTE_E6, C6, NOTE_A5, NOTE_A5, NOTE_D5, NOTE_F5, NOTE_G5, NOTE_A5, NOTE_A5, NOTE_D5, NOTE_F5, NOTE_G5, NOTE_E5, NOTE_D5, NOTE_F5, NOTE_D6, NOTE_D5, NOTE_F5, NOTE_D6, NOTE_E6, NOTE_F6, NOTE_E6, NOTE_F6, NOTE_E6, C6, NOTE_A5, NOTE_A5, NOTE_D5, NOTE_F5, NOTE_G5, NOTE_A5, A5, NOTE_D5, }; int noteDurations[] = { // note durations: 4 quarter note, 8 = eighth note, etc.: 4, 4, 8, 4, 4, 8, 8, 4, 4, 4, 4, 4, 4, 8, 8, 4, 4, 4, 8, 8, 4, 4, 4, 4, 4, 8, 4, 4, 8, 8, 4, 4, 4, 4, 4, 4,
NOTE_
NOTE_ NOTE_ =
8, 8, 4, 4, 12, 8, 20
};
for (int thisNote = 0; thisNote < 23; thisNote++) { // iterate through the notes of the melody int noteDuration = 1000 / noteDurations[thisNote]; // to calculate the note duration, take one second and divide by the note duration tone(7, melody[thisNote], noteDuration); int pauseBetweenNotes = noteDuration * 1.30; // minimum time between the notes delay(pauseBetweenNotes); noTone(7); // stop the tone playing } }
HAIKU-NATOR by CGF
MediaArchitecture/Computational Thinking Bauhaus Universität Weimar (C) 2019 by CGF www.carlosgarciafernandez.com