|
|
(12 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
− | <code>
| + | [[File:Arduino Remote DIY Mediaplayer.jpg|300px|right]] |
− | #include <gamekit_2_1.h>
| + | |
− | #include <avr/pgmspace.h>
| + | |
− | #include <EEPROM.h>
| + | |
| | | |
| + | Arduino-Remote besteht aus einer Logitech Harmony 300 Fernbedienung und einem Arduino. Beide sind so miteinander verkabelt, dass das Arduino automatisch auf die Tasten "POWER" und "OK" der Fernbedienung drückt. Auf diese Weise kann der Mediaplayer (im Digipool z.B. [[Player#Trekstor_Xtreamer_Media_Player_.26_Streamer|Trekstor Xtreamer Media Player]]) mit folgenden Funktionen eingesetzt werden. |
| | | |
− | uint8_t gkTestImage[5][7] PROGMEM = {
| + | * Autostart: Der Player startet nach automatisch nach dem der Strom angeschaltet wird. |
− | 0,19,19,19,19,19, 0,
| + | * Multi-Channel: Mehrere Player können in einem einstellbaren Takt immer wieder nahezu synchron gestartet werden. |
− | 19, 0,15, 0,15, 0,19,
| + | * Weiter Funktionen wie zum Beispiel Interaktionen mit dem Betracjter sind denkbar, müssten dann speziell programmiert werden. |
− | 19,15, 0,15, 0,15,19,
| + | |
− | 19, 0,15, 0, 0, 0,19,
| + | |
− | 0,19,19,19,19,19, 0
| + | |
| | | |
− | };
| + | <br> |
| | | |
− | int intro = 0;
| + | == Installationsanleitung == |
− | int i;
| + | |
| | | |
− | uint8_t title[5][37] PROGMEM = {
| + | * Die Stomversorgung für Player und Arduino-Remote an eine Steckerleiste anschließen. |
− | 0,0,0,0,0,0,0,9,0,0,0,9,0,0,9,9,0,0,9,9,9,9,9,0,0,9,9,9,0,0,0,0,0,0,0,0,0,
| + | * Die Fernbedienung auf die Player richten. |
− | 0,0,0,0,0,0,0,9,9,0,9,9,0,9,0,0,9,0,0,0,0,9,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,
| + | * Mit der Treksor-Fernbedienung das gewünschte Video als einzigen Favorit eintragen |
− | 0,0,0,0,0,0,0,9,0,9,0,9,0,9,9,9,9,0,0,0,9,0,0,0,9,9,9,0,0,0,0,0,0,0,0,0,0,
| + | ** Unter Mediathe (Media Library) die Videodatei anwählen und auf die Taste "FUNC" (8) drücken |
− | 0,0,0,0,0,0,0,9,0,0,0,9,0,9,0,0,9,0,0,9,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,
| + | ** Im Popupmenü auf zu Favoriten hinzufügen gehen und die "ENTER"-Taste drücken. |
− | 0,0,0,0,0,0,0,9,0,0,0,9,0,9,0,0,9,0,9,9,9,9,9,0,0,9,9,9,0,0,0,0,0,0,0,0,0
| + | * Wenn jetzt die Sromversorung an der Steckerleiste angeschaltet wird, startet das Video nach ca. 30 Sek |
− | };
| + | * (RESUME muss bei Einstellung (Setup) deaktiviert sein) |
| | | |
− | //here the labyrinths are defined
| + | <br> |
− | //15 is a wall
| + | |
− | //0 is a way
| + | |
− | //20 is the goal
| + | |
| | | |
− | uint8_t start[5][7] PROGMEM = {
| + | == Umprogrammierung == |
− | 0, 0,15, 0,15, 0, 0,
| + | |
− | 0, 0,15, 0, 0, 0, 0,
| + | |
− | 0, 0,15, 0,15, 0,20,
| + | |
− | 0, 0, 0, 0,15, 0, 0,
| + | |
− | 0, 0,15, 0,15, 0, 0
| + | |
| | | |
− | };
| + | Für die Multi-Channel Funktion oder für zusätzliche Interaktionen kann das Programm der Ardiuino-Remote verändert werden. |
| + | * Installation der Arduino Programmiersoftware [http://arduino.cc/en/Main/Software www.arduino.cc] |
| + | * Jetzt das Arduino mit dem USB-Kabel an den Computer anschließen! |
| + | * Nach dem Start der Arduino-Software den Code von dieser Seite einkopieren. |
| + | * Den Code verändern und mit "Upload to I / O Board" auf das Arduino hochladen. |
| + | * Die Looplänge hinter "t+" wird in Millisekunden eingetragen. Diese Berechnet sich aus den Sekunden x 1000. |
| | | |
− | uint8_t trick[7][9] PROGMEM = {
| + | <br> |
− | 15,15,15,15,15,15,15,15,15,
| + | |
− | 15, 0, 0, 0, 0, 0, 0, 0,15,
| + | |
− | 0, 0, 0, 0, 0,15,15, 0,15,
| + | |
− | 0, 0, 0, 0, 0,15,20, 0,15,
| + | |
− | 0, 0, 0, 0, 0,15,15, 0,15,
| + | |
− | 15, 0, 0, 0, 0, 0, 0, 0,15,
| + | |
− | 15,15,15,15,15,15,15,15,15
| + | |
| | | |
− | };
| + | == Arduino-Code == |
| | | |
− | uint8_t leicht[13][15] PROGMEM = {
| + | <source lang="java"> |
− | 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
| + | /* |
− | 0 ,0 ,0 ,15,0 ,0 ,0 ,15,0 ,0 ,0 ,0 ,0 ,0 ,15,
| + | |
− | 15,15,0 ,15,0 ,15,0 ,15,0 ,15,15,15,0 ,0 ,15,
| + | MyTrekStorePlayer |
− | 15,0 ,0 ,15,0 ,15,0 ,15,0 ,15,0 ,15,0 ,15,15,
| + | |
− | 15,0 ,15,15,0 ,15,0 ,15,0 ,15,0 ,0 ,0 ,0 ,15,
| + | Controling the TrekStorTV-Media-Player with Arduino |
− | 15,0 ,15,0 ,0 ,15,0 ,0 ,0 ,15,0 ,0 ,15,0 ,15,
| + | |
− | 15,0 ,15,0 ,15,15,15,15,0 ,15,0 ,15,15,15,15,
| + | Functions: |
− | 15,0 ,15,0 ,0 ,0 ,0 ,15,0 ,15,0 ,0 ,0 ,0 ,15,
| + | - Autostart on POWER ON |
− | 15,0 ,15,15,15,0 ,15,15,15,15,15,15,15,0 ,15,
| + | - Sync multi channel playback |
− | 15,0 ,0 ,15,0 ,0 ,0 ,15,0 ,0 ,0 ,0 ,15,0 ,15,
| + | |
− | 15,15,0 ,0 ,0 ,15,15,15,15,0 ,15,0 ,15,0 ,15,
| + | by Olaf Val |
− | 15,0 ,0 ,15,0 ,15,0 ,0 ,0 ,0 ,15,0 ,0 ,0 ,15,
| + | www.digipool.info |
− | 15,15,15,15,15,15,20,15,15,15,15,15,15,15,15
| + | |
− | };
| + | */ |
− | | + | |
− | uint8_t mittel[27][27] PROGMEM = {
| + | |
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0 ,15,0 ,0 ,0 ,0 ,0 ,15,0 ,15,0 ,0 ,0 ,15,0 ,0 ,0 ,15,0 ,0 ,0 ,15,
| + | |
− | 15,15,15,15,15,0 ,15,15,15,15,15,0 ,15,0 ,15,0 ,15,0 ,15,15,15,0 ,15,15,15,15,15,
| + | |
− | 15,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,15,0 ,0 ,0 ,15,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,20,
| + | |
− | 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
| + | |
− | };
| + | |
− | | + | |
− | uint8_t mittelschwer[8][50] PROGMEM = {
| + | |
− | 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
| + | |
− | 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,15,15,15,15,0 ,0 ,15,15,15,15,15,15,15,15,0 ,20,15,15,15,15,15,15,15,15,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,15,15,15,15,15,0 ,0 ,0 ,15,15,
| + | |
− | 15,0 ,15,15,15,15,15,0 ,15,15,0 ,0 ,0 ,15,15,15,0 ,0 ,0 ,0 ,0 ,15,0 ,15,15,15,0 ,0 ,0 ,0 ,0 ,15,15,15,15,15,15,15,15,0 ,0 ,0 ,15,15,15,15,0 ,15,15,15,
| + | |
− | 15,0 ,0 ,0 ,15,15,0 ,0 ,15,15,0 ,15,15,0 ,0 ,0 ,0 ,15,15,15,0 ,0 ,0 ,15,15,0 ,0 ,15,15,15,15,15,15,15,0 ,15,15,15,15,0 ,15,15,15,15,0 ,0 ,0 ,15,0 ,15,
| + | |
− | 15,0 ,15,15,15,0 ,0 ,15,15,15,0 ,0 ,0 ,15,15,15,15,15,15,15,0 ,15,15,15,0 ,0 ,15,15,15,15,15,15,0 ,0 ,0 ,15,15,0 ,0 ,0 ,15,15,15,15,15,0 ,0 ,15,0 ,15,
| + | |
− | 15,0 ,0 ,15,15,0 ,15,15,0 ,0 ,15,15,0 ,0 ,0 ,15,15,0 ,0 ,0 ,0 ,15,15,0 ,0 ,15,15,15,15,15,0 ,0 ,0 ,15,15,15,15,0 ,0 ,15,15,15,15,15,15,0 ,15,15,0 ,15,
| + | |
− | 15,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,15,
| + | |
− | 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
| + | |
− | };
| + | |
− | | + | |
− | uint8_t schwer[37][37] PROGMEM = {
| + | |
− | 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
| + | |
− | 15,0 ,15,0 ,0 ,0 ,15,0 ,0 ,0 ,15,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,15,0 ,0 ,0 ,0 ,0 ,15,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,20,
| + | |
− | 15,0 ,15,0 ,15,0 ,15,0 ,15,0 ,15,15,15,15,15,15,15,15,15,0 ,15,15,15,0 ,15,15,15,0 ,15,15,15,0 ,15,15,15,15,15,
| + | |
− | 15,0 ,0 ,0 ,15,0 ,15,0 ,15,0 ,0 ,0 ,15,0 ,0 ,0 ,0 ,0 ,15,0 ,0 ,0 ,0 ,0 ,0 ,0 ,15,0 ,0 ,0 ,15,0 ,0 ,0 ,0 ,0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,15,0 ,0 ,0 ,15,0 ,15,
| + | |
− | 15,0 ,15,15,15,0 ,15,15,15,0 ,15,15,15,0 ,15,0 ,15,0 ,15,0 ,15,15,15,15,15,0 ,15,15,15,0 ,15,15,15,15,15,0 ,15,
| + | |
− | 15,0 ,0 ,0 ,15,0 ,15,0 ,15,0 ,15,0 ,15,0 ,15,0 ,0 ,0 ,15,0 ,15,0 ,0 ,0 ,15,0 ,0 ,0 ,15,0 ,0 ,0 ,0 ,0 ,15,0 ,15,
| + | |
− | 15,15,15,0 ,15,0 ,15,0 ,15,0 ,15,0 ,15,0 ,15,0 ,15,15,15,0 ,15,0 ,15,0 ,15,15,15,0 ,15,15,15,15,15,0 ,15,0 ,15,
| + | |
− | 15,0 ,15,0 ,15,0 ,0 ,0 ,15,0 ,0 ,0 ,15,0 ,15,0 ,0 ,0 ,0 ,0 ,0 ,0 ,15,0 ,0 ,0 ,15,0 ,0 ,0 ,15,0 ,0 ,0 ,15,0 ,15,
| + | |
− | 15,0 ,15,0 ,15,15,15,15,15,15,15,0 ,15,0 ,15,0 ,15,15,15,15,15,15,15,15,15,0 ,15,15,15,0 ,15,0 ,15,15,15,0 ,15,
| + | |
− | 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,15,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,15,0 ,0 ,0 ,0 ,0 ,15,0 ,0 ,0 ,0 ,0 ,15,
| + | |
− | 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
| + | |
− | };
| + | |
| | | |
| + | int i=1; // Button Inbut |
| + | unsigned long t; // Timer |
| + | int l = 0; // loop |
| | | |
| void setup(){ | | void setup(){ |
− | gamekit.Begin(); | + | pinMode(13, OUTPUT); // LED |
− | gamekit.set_button_timing(20, 20); | + | pinMode(12, INPUT); // Button |
| + | digitalWrite(12, HIGH); // Pullup-resistor of button |
| + | pinMode(11, OUTPUT); // Relais 1 POWER |
| + | pinMode(10, OUTPUT); // Relais-Power 1 und 2 |
| + | pinMode(9, OUTPUT); // Relais 2 OK |
| | | |
− | Serial.begin(115200); | + | Serial.begin(9600); |
− | Serial.println("begin");
| + | |
| } | | } |
− |
| |
− |
| |
− |
| |
| | | |
| void loop(){ | | void loop(){ |
| | | |
− | //Intro | + | relaisON(); |
− | if(intro==0){
| + | |
− | intro=1;
| + | |
− | gkTest();
| + | |
− | }
| + | |
− | if(intro==1){
| + | |
− | intro=2;
| + | |
− | introAni();
| + | |
− | }
| + | |
| | | |
− | //Now use the play_labyrinth function to play the layrinths | + | digitalWrite(13, HIGH); |
− | //play_labyrinth( (uint8_t *) name, size_r, size_c, start_r, start_c);
| + | |
− | //
| + | |
− | //where "name" ist the name of the labyrinth
| + | |
− | //size_r and size_c are the rows and columns of the labyrinth map
| + | |
− | //start_r and start_c is the start point in the labyrinth
| + | |
| | | |
− | play_labyrinth( (uint8_t *) start, 5, 7, 2, 0);
| + | delay(5000); |
− | winning_sound();
| + | |
− | delay(1000); //wait some time before startting next level | + | |
| | | |
− | play_labyrinth( (uint8_t *) trick, 7, 9, 3, 0); | + | pressPOWER(); |
− | winning_sound();
| + | |
− | delay(1000); //wait some time before startting next level
| + | |
| | | |
− | play_labyrinth( (uint8_t *) leicht, 13, 15, 1, 0);
| + | delay(20000); // wait for menu |
− | winning_sound();
| + | |
− | delay(1000); //wait some time before startting next level | + | |
| | | |
− | play_labyrinth( (uint8_t *) mittelschwer, 8, 50, 1, 0); | + | pressOK(); |
− | winning_sound();
| + | |
− | delay(1000);
| + | |
| | | |
− | play_labyrinth( (uint8_t *) mittel, 27, 27, 1, 0);
| |
− | winning_sound();
| |
| delay(1000); | | delay(1000); |
| | | |
− | play_labyrinth( (uint8_t *) schwer, 37, 37, 35, 0); | + | pressOK(); |
− | winning_sound(); | + | |
− | delay(1000); | + | l=0; |
| | | |
− | } | + | while(l==0){ |
| + | t = millis(); |
| + | while(millis() < (t+1320000)){ |
| + | //getBUTTON(); |
| + | } |
| | | |
| + | // movie length 22:00 = 1.320.000,- millis |
| | | |
| + | delay(5000); // wait 5 sec. for menu |
| | | |
| + | pressOK(); |
| | | |
− | void play_labyrinth(uint8_t* map_ptr, uint8_t map_r_size, uint8_t map_c_size, uint8_t r_start, uint8_t c_start)
| + | } |
− | {
| + | |
− | uint8_t cursor_r_pos = r_start; | + | |
− | uint8_t cursor_c_pos = c_start;
| + | |
| | | |
− | uint8_t map_r_pos = r_start;
| |
− | uint8_t map_c_pos = c_start;
| |
| | | |
− | uint8_t old_cursor_r_pos;
| + | } |
− | uint8_t old_cursor_c_pos;
| + | |
| | | |
− | // run some cycles to shift the frame to a "valid" position | + | void pressOK(){ |
− | for (uint8_t i = 0; i <= 7; i++) | + | digitalWrite(9, LOW); |
− | { | + | digitalWrite(13, LOW); |
− | if( ( (cursor_r_pos < (map_r_pos + 1)) || (map_r_pos >= map_r_size - 4) ) && map_r_pos != 0)
| + | delay(500); |
− | map_r_pos--;
| + | digitalWrite(9, HIGH); |
| + | digitalWrite(13, HIGH); |
| + | Serial.println("OK"); |
| + | delay(1000); |
| + | } |
| | | |
− | if( cursor_r_pos > (map_r_pos + 3) && map_r_pos < map_r_size - 5)
| |
− | map_r_pos++;
| |
− |
| |
− | if( ( (cursor_c_pos < (map_c_pos + 1)) || (map_c_pos >= map_c_size - 6) ) && map_c_pos != 0)
| |
− | map_c_pos--;
| |
− |
| |
− | if( cursor_c_pos > (map_c_pos + 5) && map_c_pos < map_c_size - 7)
| |
− | map_c_pos++;
| |
− | };
| |
− |
| |
− | // force a redraw for first display !
| |
− | uint8_t old_map_r_pos = map_r_pos + 1;
| |
− | uint8_t old_map_c_pos = map_c_pos + 1;
| |
− |
| |
− | // play game until the cursor reches the goal
| |
− | while ( gamekit.get_pixel(cursor_r_pos - map_r_pos, cursor_c_pos - map_c_pos) != 20 )
| |
− | {
| |
− |
| |
− | // check buttons and wall collision (if the pixel has a value of 15 it is a wall!)
| |
− | // moreover the cursor has'nt to be outside the map
| |
− | if(gamekit.button_pressed(butt_UP))
| |
− | if ((gamekit.get_pixel(cursor_r_pos - map_r_pos - 1, cursor_c_pos - map_c_pos) != 15) )
| |
− | if (cursor_r_pos != 0)
| |
− | cursor_r_pos--;
| |
− |
| |
− | if(gamekit.button_pressed(butt_DOWN))
| |
− | if (gamekit.get_pixel(cursor_r_pos - map_r_pos + 1, cursor_c_pos - map_c_pos) != 15)
| |
− | if (cursor_r_pos < map_r_size )
| |
− | cursor_r_pos++;
| |
− |
| |
− | if(gamekit.button_pressed(butt_LEFT))
| |
− | if (gamekit.get_pixel(cursor_r_pos - map_r_pos, cursor_c_pos - map_c_pos - 1) != 15)
| |
− | if (cursor_c_pos != 0)
| |
− | cursor_c_pos--;
| |
− |
| |
− | if(gamekit.button_pressed(butt_RIGHT))
| |
− | if (gamekit.get_pixel(cursor_r_pos - map_r_pos, cursor_c_pos - map_c_pos + 1) != 15)
| |
− | if (cursor_c_pos < map_c_size )
| |
− | cursor_c_pos++;
| |
− |
| |
− |
| |
− | // move frame to ensure that the cursor is in the display
| |
− | if( (cursor_r_pos < (map_r_pos + 1)) && map_r_pos != 0)
| |
− | map_r_pos--;
| |
− |
| |
− | if( cursor_r_pos > (map_r_pos + 3) && map_r_pos < map_r_size - 5)
| |
− | map_r_pos++;
| |
− |
| |
− | if( cursor_c_pos < (map_c_pos + 1) && map_c_pos != 0)
| |
− | map_c_pos--;
| |
− |
| |
− | if( cursor_c_pos > (map_c_pos + 5) && map_c_pos < map_c_size - 7)
| |
− | map_c_pos++;
| |
− |
| |
− |
| |
− | // redraw display if necessary
| |
− | if( (map_r_pos != old_map_r_pos) || (map_c_pos != old_map_c_pos) )
| |
− | {
| |
− | gamekit.load_map( (uint8_t *) map_ptr, map_r_size, map_c_size, map_r_pos, map_c_pos);
| |
− | // if the cursor reaches the goal let it go into it (thus not redraw it)
| |
− | if(gamekit.get_pixel(cursor_r_pos - map_r_pos, cursor_c_pos - map_c_pos) != 20)
| |
− | gamekit.set_pixel(cursor_r_pos - map_r_pos, cursor_c_pos - map_c_pos, 18);
| |
− | old_cursor_r_pos = cursor_r_pos;
| |
− | old_cursor_c_pos = cursor_c_pos;
| |
− | old_map_r_pos = map_r_pos;
| |
− | old_map_c_pos = map_c_pos;
| |
− | }
| |
− | else
| |
− | if( (cursor_r_pos != old_cursor_r_pos) || (cursor_c_pos != old_cursor_c_pos) )
| |
− | {
| |
− | gamekit.set_pixel(old_cursor_r_pos - map_r_pos, old_cursor_c_pos - map_c_pos, 0);
| |
− | // if the cursor reaches the goal let it go into it (thus not redraw it)
| |
− | if(gamekit.get_pixel(cursor_r_pos - map_r_pos, cursor_c_pos - map_c_pos) != 20)
| |
− | gamekit.set_pixel(cursor_r_pos - map_r_pos, cursor_c_pos - map_c_pos, 18);
| |
− | old_cursor_r_pos = cursor_r_pos;
| |
− | old_cursor_c_pos = cursor_c_pos;
| |
− | };
| |
− | }
| |
| | | |
| + | void pressPOWER(){ |
| + | Serial.println("Power"); |
| + | delay(100); |
| + | digitalWrite(11, LOW); |
| + | digitalWrite(13, LOW); |
| + | delay(1500); |
| + | digitalWrite(11, HIGH); |
| + | digitalWrite(13, HIGH); |
| + | delay(1000); |
| } | | } |
| | | |
− | void winning_sound(){ | + | void relaisON(){ |
− | gamekit.play_tone(100,500,LOUD); | + | Serial.println("Relais ON"); |
− | gamekit.play_tone(300,100,LOUD); | + | digitalWrite(9, HIGH); |
| + | digitalWrite(11, HIGH); |
| delay(100); | | delay(100); |
− | gamekit.play_tone(100,100,LOUD); | + | digitalWrite(10, HIGH); |
− | gamekit.play_tone(300,900,LOUD); | + | delay(1000); |
| } | | } |
| | | |
− | void introAni(){ | + | void waitBUTTON(){ |
− | for(i=0; i<37; i++){ | + | Serial.println("Wait Button"); |
− | gamekit.load_map((uint8_t*) title,5,37,0,i);
| + | while(i==1){ |
− | //delay(100);
| + | i = digitalRead(12); |
− | gamekit.play_tone(500,100,SILENT); | + | |
| } | | } |
− | gamekit.play_tone(100,500,LOUD); | + | i = 1; |
− | gamekit.play_tone(300,100,LOUD);
| + | } |
| | | |
| + | void getBUTTON(){ |
| | | |
− | }
| |
| | | |
− | void gkTest(){
| + | i = digitalRead(12); |
− | int testNr=0; | + | if(i == 0){ |
− | testNr = EEPROM.read(0);
| + | Serial.println("Get Button"); |
− |
| + | i = 1; |
− | if(testNr >= 2){ | + | l=1; |
− | //gamekit.set_pixel(2,3,20); | + | |
− | delay(200); | + | |
− | if(gamekit.button_pressed(butt_UP)){ | + | |
− | EEPROM.write(0,0);
| + | |
− | testNr = 0;
| + | |
− | }
| + | |
| } | | } |
− |
| |
− | if(testNr < 2){
| |
| | | |
− | for(int testX = 0; testX < 25; testX++){
| |
− | gamekit.set_pixel(2, 3, random(16));
| |
− | gamekit.play_tone(random(1000), 10, LOUD);
| |
− | }
| |
− | for(int testX = 0; testX < 25; testX++){
| |
− | gamekit.set_pixel(1, 1, random(16));
| |
− | gamekit.set_pixel(1, 2, random(16));
| |
− | gamekit.set_pixel(1, 3, random(16));
| |
− | gamekit.set_pixel(1, 4, random(16));
| |
− | gamekit.set_pixel(1, 5, random(16));
| |
− | gamekit.set_pixel(2, 1, random(16));
| |
− | gamekit.set_pixel(2, 2, random(16));
| |
− | gamekit.set_pixel(2, 4, random(16));
| |
− | gamekit.set_pixel(2, 5, random(16));
| |
− | gamekit.set_pixel(3, 1, random(16));
| |
− | gamekit.set_pixel(3, 2, random(16));
| |
− | gamekit.set_pixel(3, 3, random(16));
| |
− | gamekit.set_pixel(3, 4, random(16));
| |
− | gamekit.set_pixel(3, 5, random(16));
| |
− |
| |
− | gamekit.play_tone(random(1000), 10, LOUD);
| |
− |
| |
− | }
| |
− |
| |
− | gamekit.load_image(gkTestImage);
| |
− | int waitButtons = 0;
| |
− | while(waitButtons < 6){
| |
− | if(gamekit.button_pressed(butt_FUNCA)){
| |
− | if(gamekit.get_pixel(1, 4) == 15){
| |
− | gamekit.set_pixel(1, 4, 0);
| |
− | waitButtons++;
| |
− | gamekit.play_tone(random(1000), 100, LOUD);
| |
− | }
| |
− | }
| |
− | if(gamekit.button_pressed(butt_FUNCB)){
| |
− | if(gamekit.get_pixel(2, 5) == 15){
| |
− | gamekit.set_pixel(2, 5, 0);
| |
− | waitButtons++;
| |
− | gamekit.play_tone(random(1000), 100, LOUD);
| |
− | }
| |
− | }
| |
− | if(gamekit.button_pressed(butt_UP)){
| |
− | if(gamekit.get_pixel(1, 2) == 15){
| |
− | gamekit.set_pixel(1, 2, 0);
| |
− | waitButtons++;
| |
− | gamekit.play_tone(random(1000), 100, SILENT);
| |
− | }
| |
− | }
| |
− | if(gamekit.button_pressed(butt_DOWN)){
| |
− | if(gamekit.get_pixel(3, 2) == 15){
| |
− | gamekit.set_pixel(3, 2, 0);
| |
− | waitButtons++;
| |
− | gamekit.play_tone(random(1000), 100, SILENT);
| |
− | }
| |
− | }
| |
− | if(gamekit.button_pressed(butt_LEFT)){
| |
− | if(gamekit.get_pixel(2, 1) == 15){
| |
− | gamekit.set_pixel(2, 1, 0);
| |
− | waitButtons++;
| |
− | gamekit.play_tone(random(1000), 100, SILENT);
| |
− | }
| |
− | }
| |
− | if(gamekit.button_pressed(butt_RIGHT)){
| |
− | if(gamekit.get_pixel(2, 3) == 15){
| |
− | gamekit.set_pixel(2, 3, 0);
| |
− | waitButtons++;
| |
− | gamekit.play_tone(random(1000), 100, SILENT);
| |
− | }
| |
− | }
| |
− | }
| |
− | testNr++;
| |
− | EEPROM.write(0, testNr);
| |
− | delay(1000);
| |
− | }
| |
| } | | } |
− | </code> | + | </source> |
Arduino-Remote besteht aus einer Logitech Harmony 300 Fernbedienung und einem Arduino. Beide sind so miteinander verkabelt, dass das Arduino automatisch auf die Tasten "POWER" und "OK" der Fernbedienung drückt. Auf diese Weise kann der Mediaplayer (im Digipool z.B. Trekstor Xtreamer Media Player) mit folgenden Funktionen eingesetzt werden.
Für die Multi-Channel Funktion oder für zusätzliche Interaktionen kann das Programm der Ardiuino-Remote verändert werden.