From: Tomas Mudrunka Date: Sat, 30 Oct 2021 12:10:40 +0000 (+0200) Subject: Aktualni X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=46a1695823fd4553a6f481c65b2594340d99dbc4;p=mirrors%2FPrograms.git Aktualni --- diff --git a/arduino/Exit_Rum/bomba2b/bomba2b.ino b/arduino/Exit_Rum/bomba2b/bomba2b.ino index 6ac34f2..5c49c1c 100644 --- a/arduino/Exit_Rum/bomba2b/bomba2b.ino +++ b/arduino/Exit_Rum/bomba2b/bomba2b.ino @@ -6,7 +6,7 @@ //Nastaveni bomby #define DISARM_CODE "73138477" -#define TIME_COUNTDOWN 600 +#define TIME_COUNTDOWN 600 //600 //#define TIME_COUNTDOWN 15 //Prirazeni pinu @@ -27,13 +27,20 @@ ////////////////////////////////////////////////////////////////// +#define SOFTSERIAL + +#ifndef SOFTSERIAL #include +PS2Keyboard keyboard; +#else +#include +SoftwareSerial mySerial(PIN_KEY_CLK, PIN_KEY_DATA); +#endif //#include // Enable this line if using Arduino Uno, Mega, etc. #include #include "Adafruit_LEDBackpack.h" -PS2Keyboard keyboard; Adafruit_7segment display = Adafruit_7segment(); #define cnt_sec(s) (s%60) @@ -44,7 +51,12 @@ void setup() { //Pripravime periferie Serial.begin(9600); + Serial.println("zaciname"); +#ifndef SOFTSERIAL keyboard.begin(PIN_KEY_DATA, PIN_KEY_CLK); +#else + mySerial.begin(4800); +#endif display.begin(ADDR_DISPLAY); pinMode(PIN_LED_R, OUTPUT); @@ -64,19 +76,40 @@ int test_disarmed(int reset) disarmed = 0; } //Cteme klavesnici +#ifndef SOFTSERIAL while (keyboard.available()) { - char c = keyboard.read(); + char c = keyboard.read(); + //Serial.print("Klavesa: "); + //Serial.println(c); +#else + while (mySerial.available()) { + char c = mySerial.read(); +#endif +#ifndef SOFTSERIAL if (c == PS2_ENTER) { Serial.println(); } else { +#else + if(1) { +#endif Serial.print(c); } + + if (c < '0' || c > '9') { + Serial.println("IGNORED!"); + continue; + + } if (c == DISARM_CODE[guessed]) { guessed++; Serial.println("\nGOT!"); } else { guessed = 0; Serial.println("\nFAIL!"); + if (c == DISARM_CODE[guessed]) { + guessed++; + Serial.println("\nGOT!"); + } } if (DISARM_CODE[guessed] == 0) { disarmed = 1; @@ -101,8 +134,13 @@ void loop() display.setBrightness(15); display.writeDisplay(); +#ifndef SOFTSERIAL while (keyboard.available()) keyboard.read(); +#else + while (mySerial.available()) + mySerial.read(); +#endif test_disarmed(1); //Pockame na pripojeni kabelu diff --git a/arduino/Exit_Rum/old/bomba-ledtest/bomba-ledtest.ino b/arduino/Exit_Rum/old/bomba-ledtest/bomba-ledtest.ino new file mode 100644 index 0000000..f0f9f7a --- /dev/null +++ b/arduino/Exit_Rum/old/bomba-ledtest/bomba-ledtest.ino @@ -0,0 +1,68 @@ +#include + +LedControl lc=LedControl(16,14,15,2); //datain, clk, load, number of chips + +/* we always wait a bit between updates of the display */ +unsigned long delaytime=250; + +void setup() { + /* + The MAX72XX is in power-saving mode on startup, + we have to do a wakeup call + */ + lc.shutdown(0,false); + /* Set the brightness to a medium values */ + lc.setIntensity(0,15); //0 - 15 + /* and clear the display */ + lc.clearDisplay(0); +} + + +/* + This method will display the characters for the + word "Arduino" one after the other on digit 0. + */ +void writeArduinoOn7Segment() { + lc.setChar(0,0,'a',false); + delay(delaytime); + lc.setRow(0,0,0x05); + delay(delaytime); + lc.setChar(0,0,'d',false); + delay(delaytime); + lc.setRow(0,0,0x1c); + delay(delaytime); + lc.setRow(0,0,B00010000); + delay(delaytime); + lc.setRow(0,0,0x15); + delay(delaytime); + lc.setRow(0,0,0x1D); + delay(delaytime); + lc.clearDisplay(0); + delay(delaytime); +} + +/* + This method will scroll all the hexa-decimal + numbers and letters on the display. You will need at least + four 7-Segment digits. otherwise it won't really look that good. + */ +void scrollDigits() { + for(int i=0;i<13;i++) { + lc.setDigit(0,7,i,false); + lc.setDigit(0,6,i+1,false); + lc.setDigit(0,5,i+2,false); + lc.setDigit(0,4,i+3,false); + lc.setDigit(0,3,i+4,false); + lc.setDigit(0,2,i+5,false); + lc.setDigit(0,1,i+6,false); + lc.setDigit(0,0,i+7,false); + delay(delaytime); + } + lc.clearDisplay(0); + delay(delaytime); +} + +void loop() { + writeArduinoOn7Segment(); + scrollDigits(); +} diff --git a/arduino/Exit_Rum/old/bomba-ps2test/bomba-ps2test.ino b/arduino/Exit_Rum/old/bomba-ps2test/bomba-ps2test.ino new file mode 100644 index 0000000..57160a3 --- /dev/null +++ b/arduino/Exit_Rum/old/bomba-ps2test/bomba-ps2test.ino @@ -0,0 +1,26 @@ +#include + +PS2dev keyboard(19, 18); //clock, data + +void make_break_kb(byte data) +{ +// makes and breaks the key + keyboard.write(data); + delay(50); + keyboard.write(0xF0); + delay(50); + keyboard.write(data); + delay(50); +} + +void setup() { +} + +char scancodes[] = {0x45, 0x16, 0x1E, 0x26, 0x25, 0x2E, 0x36, 0x3D, 0x3E, 0x46, 0x7C, 0x7C}; //Scancodes for numbers 0-9, *, # + +void loop() { + for(int i = 0; i < 11; i++) { + make_break_kb(scancodes[i]); + delay(1000); + } +} diff --git a/arduino/Exit_Rum/old/bomba2/bomba2.ino/bomba2.ino.ino b/arduino/Exit_Rum/old/bomba2/bomba2.ino/bomba2.ino.ino new file mode 100644 index 0000000..b104cc7 --- /dev/null +++ b/arduino/Exit_Rum/old/bomba2/bomba2.ino/bomba2.ino.ino @@ -0,0 +1,104 @@ +/* +*/ + +//Nastaveni bomby + +#define TIME_COUNTDOWN 600 + + +//Prirazeni pinu + +#define PIN_CABLE_CHECK 2 + +#define PIN_KEY_CLK 3 //IRQ! +#define PIN_KEY_DATA 4 + +#define PIN_LED_R 5 +#define PIN_LED_G 6 +#define PIN_LED_B 7 + +#define PIN_COIL_LO 10 +#define PIN_COIL_HI 11 + +#define ADDR_DISPLAY 0x70 + +////////////////////////////////////////////////////////////////// + +#include + +//#include // Enable this line if using Arduino Uno, Mega, etc. +#include +#include "Adafruit_LEDBackpack.h" + +PS2Keyboard keyboard; +Adafruit_7segment display = Adafruit_7segment(); + +void setup() { + Serial.begin(9600); + Serial.println("Keyboard Test:"); + + keyboard.begin(PIN_KEY_DATA, PIN_KEY_CLK); + + display.begin(ADDR_DISPLAY); + display.clear(); + //display.writeDisplay(); + + pinMode(PIN_LED_R, OUTPUT); + pinMode(PIN_LED_G, OUTPUT); + pinMode(PIN_LED_B, OUTPUT); + pinMode(PIN_COIL_LO, OUTPUT); + pinMode(PIN_COIL_HI, OUTPUT); + pinMode(PIN_CABLE_CHECK, INPUT_PULLUP); +} + +void loop() { + if (keyboard.available()) { + + // read the next key + char c = keyboard.read(); + + // check for some of the special keys + if (c == PS2_ENTER) { + Serial.println(); + } else { + Serial.print(c); + } + + if(digitalRead(PIN_CABLE_CHECK)) c+=16; + display.print(c, HEX); + display.drawColon(c%2); + //display.setBrightness(random(0,15)); + display.setBrightness(0); + //display.clear(); + display.writeDisplay(); + + + if(c%2) { + analogWrite(PIN_LED_R, random(0,255)); // turn the LED on (HIGH is the voltage level) + analogWrite(PIN_LED_G, random(0,255)); // turn the LED on (HIGH is the voltage level) + analogWrite(PIN_LED_B, random(0,255)); // turn the LED on (HIGH is the voltage level) + digitalWrite(PIN_COIL_HI, HIGH); // turn the LED on (HIGH is the voltage level) + } else { + digitalWrite(PIN_COIL_LO, HIGH); // turn the LED on (HIGH is the voltage level) + digitalWrite(PIN_LED_R, LOW); // turn the LED on (HIGH is the voltage level) + digitalWrite(PIN_LED_G, LOW); // turn the LED on (HIGH is the voltage level) + digitalWrite(PIN_LED_B, LOW); // turn the LED on (HIGH is the voltage level) + } + delay(random(1,15)); // wait for a second + digitalWrite(PIN_COIL_LO, LOW); // turn the LED off by making the voltage LOW + digitalWrite(PIN_COIL_HI, LOW); // turn the LED off by making the voltage LOW + + if(c == '.') { + int d = random(100,1000); + for(int i = 0; i < 1000; i++) { + + digitalWrite(PIN_COIL_LO, HIGH); //digitalWrite(11, HIGH); + delayMicroseconds(d/2); + digitalWrite(PIN_COIL_LO, LOW); //digitalWrite(11, LOW); + delayMicroseconds(d/2); + } + } + } + + +} diff --git a/arduino/Exit_Rum/old/bomba2/bomba2b/bomba2b.ino b/arduino/Exit_Rum/old/bomba2/bomba2b/bomba2b.ino new file mode 100644 index 0000000..b104cc7 --- /dev/null +++ b/arduino/Exit_Rum/old/bomba2/bomba2b/bomba2b.ino @@ -0,0 +1,104 @@ +/* +*/ + +//Nastaveni bomby + +#define TIME_COUNTDOWN 600 + + +//Prirazeni pinu + +#define PIN_CABLE_CHECK 2 + +#define PIN_KEY_CLK 3 //IRQ! +#define PIN_KEY_DATA 4 + +#define PIN_LED_R 5 +#define PIN_LED_G 6 +#define PIN_LED_B 7 + +#define PIN_COIL_LO 10 +#define PIN_COIL_HI 11 + +#define ADDR_DISPLAY 0x70 + +////////////////////////////////////////////////////////////////// + +#include + +//#include // Enable this line if using Arduino Uno, Mega, etc. +#include +#include "Adafruit_LEDBackpack.h" + +PS2Keyboard keyboard; +Adafruit_7segment display = Adafruit_7segment(); + +void setup() { + Serial.begin(9600); + Serial.println("Keyboard Test:"); + + keyboard.begin(PIN_KEY_DATA, PIN_KEY_CLK); + + display.begin(ADDR_DISPLAY); + display.clear(); + //display.writeDisplay(); + + pinMode(PIN_LED_R, OUTPUT); + pinMode(PIN_LED_G, OUTPUT); + pinMode(PIN_LED_B, OUTPUT); + pinMode(PIN_COIL_LO, OUTPUT); + pinMode(PIN_COIL_HI, OUTPUT); + pinMode(PIN_CABLE_CHECK, INPUT_PULLUP); +} + +void loop() { + if (keyboard.available()) { + + // read the next key + char c = keyboard.read(); + + // check for some of the special keys + if (c == PS2_ENTER) { + Serial.println(); + } else { + Serial.print(c); + } + + if(digitalRead(PIN_CABLE_CHECK)) c+=16; + display.print(c, HEX); + display.drawColon(c%2); + //display.setBrightness(random(0,15)); + display.setBrightness(0); + //display.clear(); + display.writeDisplay(); + + + if(c%2) { + analogWrite(PIN_LED_R, random(0,255)); // turn the LED on (HIGH is the voltage level) + analogWrite(PIN_LED_G, random(0,255)); // turn the LED on (HIGH is the voltage level) + analogWrite(PIN_LED_B, random(0,255)); // turn the LED on (HIGH is the voltage level) + digitalWrite(PIN_COIL_HI, HIGH); // turn the LED on (HIGH is the voltage level) + } else { + digitalWrite(PIN_COIL_LO, HIGH); // turn the LED on (HIGH is the voltage level) + digitalWrite(PIN_LED_R, LOW); // turn the LED on (HIGH is the voltage level) + digitalWrite(PIN_LED_G, LOW); // turn the LED on (HIGH is the voltage level) + digitalWrite(PIN_LED_B, LOW); // turn the LED on (HIGH is the voltage level) + } + delay(random(1,15)); // wait for a second + digitalWrite(PIN_COIL_LO, LOW); // turn the LED off by making the voltage LOW + digitalWrite(PIN_COIL_HI, LOW); // turn the LED off by making the voltage LOW + + if(c == '.') { + int d = random(100,1000); + for(int i = 0; i < 1000; i++) { + + digitalWrite(PIN_COIL_LO, HIGH); //digitalWrite(11, HIGH); + delayMicroseconds(d/2); + digitalWrite(PIN_COIL_LO, LOW); //digitalWrite(11, LOW); + delayMicroseconds(d/2); + } + } + } + + +} diff --git a/arduino/Exit_Rum/old/bomba2b-pre/bomba2b.ino b/arduino/Exit_Rum/old/bomba2b-pre/bomba2b.ino new file mode 100644 index 0000000..6ac34f2 --- /dev/null +++ b/arduino/Exit_Rum/old/bomba2b-pre/bomba2b.ino @@ -0,0 +1,181 @@ +/* + * Exit Rum 2 + * (c) Tomas 'Harvie' Mudrunka 2018 + */ + +//Nastaveni bomby + +#define DISARM_CODE "73138477" +#define TIME_COUNTDOWN 600 +//#define TIME_COUNTDOWN 15 + +//Prirazeni pinu + +#define PIN_CABLE_CHECK 2 + +#define PIN_KEY_CLK 3 //IRQ! +#define PIN_KEY_DATA 4 + +#define PIN_LED_G 5 +#define PIN_LED_B 6 +#define PIN_LED_R 7 + +#define PIN_COIL_LO 10 +#define PIN_COIL_HI 11 + +#define ADDR_DISPLAY 0x70 + +////////////////////////////////////////////////////////////////// + +#include + +//#include // Enable this line if using Arduino Uno, Mega, etc. +#include +#include "Adafruit_LEDBackpack.h" + +PS2Keyboard keyboard; +Adafruit_7segment display = Adafruit_7segment(); + +#define cnt_sec(s) (s%60) +#define cnt_min(s) (s/60) +#define cnt_dec(s) (cnt_min(s)*100+cnt_sec(s)) + +void setup() +{ + //Pripravime periferie + Serial.begin(9600); + keyboard.begin(PIN_KEY_DATA, PIN_KEY_CLK); + display.begin(ADDR_DISPLAY); + + pinMode(PIN_LED_R, OUTPUT); + pinMode(PIN_LED_G, OUTPUT); + pinMode(PIN_LED_B, OUTPUT); + pinMode(PIN_COIL_LO, OUTPUT); + pinMode(PIN_COIL_HI, OUTPUT); + pinMode(PIN_CABLE_CHECK, INPUT_PULLUP); +} + +int test_disarmed(int reset) +{ + + static int guessed = 0, disarmed = 0; + if (reset) { + guessed = 0; + disarmed = 0; + } + //Cteme klavesnici + while (keyboard.available()) { + char c = keyboard.read(); + if (c == PS2_ENTER) { + Serial.println(); + } else { + Serial.print(c); + } + if (c == DISARM_CODE[guessed]) { + guessed++; + Serial.println("\nGOT!"); + } else { + guessed = 0; + Serial.println("\nFAIL!"); + } + if (DISARM_CODE[guessed] == 0) { + disarmed = 1; + Serial.println("\nDISARMED!"); + } + } + + return disarmed; + +} + +void loop() +{ + //Vynulujem periferie + digitalWrite(PIN_COIL_LO, LOW); + digitalWrite(PIN_COIL_HI, LOW); + analogWrite(PIN_LED_R, 0); + analogWrite(PIN_LED_G, 0); + analogWrite(PIN_LED_B, 0); + + display.clear(); + display.setBrightness(15); + display.writeDisplay(); + + while (keyboard.available()) + keyboard.read(); + test_disarmed(1); + + //Pockame na pripojeni kabelu + display.print(0xCAB1, HEX); + display.writeDisplay(); + while (digitalRead(PIN_CABLE_CHECK)) + delay(100); + + //Pockame na odpojeni kabelu + display.clear(); + display.writeDisplay(); + while (!digitalRead(PIN_CABLE_CHECK)) + delay(100); + + //Odpocitavame + for (int cnt = TIME_COUNTDOWN; cnt >= 0 && !test_disarmed(0); cnt--) { + display.print(cnt_dec(cnt), DEC); + display.drawColon((cnt + 1) % 2); + display.writeDisplay(); + + analogWrite(PIN_LED_R, random(0, 3)); + analogWrite(PIN_LED_G, random(0, 3)); + analogWrite(PIN_LED_B, random(0, 3)); + + //Tikani / pipani + tone(PIN_COIL_LO, 1000, 50); + delay(60); + digitalWrite(PIN_COIL_LO, HIGH); + delay(40); + digitalWrite(PIN_COIL_LO, LOW); + + delay(900); + + } + + + while (!test_disarmed(0)) { + //Bomba vybouchla + int i; + + analogWrite(PIN_LED_R, random(0, 255)); + analogWrite(PIN_LED_G, random(0, 0)); + analogWrite(PIN_LED_B, random(0, 255)); + + for (i = 0; i < 10; i++) + display.writeDigitRaw(i, random(0, 255)); + display.setBrightness(random(0, 15)); + display.writeDisplay(); + + digitalWrite(PIN_COIL_HI, HIGH); + delay(20); + digitalWrite(PIN_COIL_HI, LOW); + int rnd = random(30, 100); + tone(PIN_COIL_LO, random(100, 8000), rnd); + delay(rnd); + } + + + //Bomba byla deaktivovana + tone(PIN_COIL_LO, 3000, 500); + delay(500); + tone(PIN_COIL_LO, 5000, 500); + analogWrite(PIN_LED_R, 0); + analogWrite(PIN_LED_G, 0); + analogWrite(PIN_LED_B, 0); + display.print(0xDEFD, HEX); + display.writeDisplay(); + delay(1000); + + + //Pockame na zmenu kabelu + char s = digitalRead(PIN_CABLE_CHECK); + while (digitalRead(PIN_CABLE_CHECK) == s) + delay(100); + +} diff --git a/arduino/Exit_Rum/old/bomba2b/bomba2b.ino b/arduino/Exit_Rum/old/bomba2b/bomba2b.ino new file mode 100644 index 0000000..6ac34f2 --- /dev/null +++ b/arduino/Exit_Rum/old/bomba2b/bomba2b.ino @@ -0,0 +1,181 @@ +/* + * Exit Rum 2 + * (c) Tomas 'Harvie' Mudrunka 2018 + */ + +//Nastaveni bomby + +#define DISARM_CODE "73138477" +#define TIME_COUNTDOWN 600 +//#define TIME_COUNTDOWN 15 + +//Prirazeni pinu + +#define PIN_CABLE_CHECK 2 + +#define PIN_KEY_CLK 3 //IRQ! +#define PIN_KEY_DATA 4 + +#define PIN_LED_G 5 +#define PIN_LED_B 6 +#define PIN_LED_R 7 + +#define PIN_COIL_LO 10 +#define PIN_COIL_HI 11 + +#define ADDR_DISPLAY 0x70 + +////////////////////////////////////////////////////////////////// + +#include + +//#include // Enable this line if using Arduino Uno, Mega, etc. +#include +#include "Adafruit_LEDBackpack.h" + +PS2Keyboard keyboard; +Adafruit_7segment display = Adafruit_7segment(); + +#define cnt_sec(s) (s%60) +#define cnt_min(s) (s/60) +#define cnt_dec(s) (cnt_min(s)*100+cnt_sec(s)) + +void setup() +{ + //Pripravime periferie + Serial.begin(9600); + keyboard.begin(PIN_KEY_DATA, PIN_KEY_CLK); + display.begin(ADDR_DISPLAY); + + pinMode(PIN_LED_R, OUTPUT); + pinMode(PIN_LED_G, OUTPUT); + pinMode(PIN_LED_B, OUTPUT); + pinMode(PIN_COIL_LO, OUTPUT); + pinMode(PIN_COIL_HI, OUTPUT); + pinMode(PIN_CABLE_CHECK, INPUT_PULLUP); +} + +int test_disarmed(int reset) +{ + + static int guessed = 0, disarmed = 0; + if (reset) { + guessed = 0; + disarmed = 0; + } + //Cteme klavesnici + while (keyboard.available()) { + char c = keyboard.read(); + if (c == PS2_ENTER) { + Serial.println(); + } else { + Serial.print(c); + } + if (c == DISARM_CODE[guessed]) { + guessed++; + Serial.println("\nGOT!"); + } else { + guessed = 0; + Serial.println("\nFAIL!"); + } + if (DISARM_CODE[guessed] == 0) { + disarmed = 1; + Serial.println("\nDISARMED!"); + } + } + + return disarmed; + +} + +void loop() +{ + //Vynulujem periferie + digitalWrite(PIN_COIL_LO, LOW); + digitalWrite(PIN_COIL_HI, LOW); + analogWrite(PIN_LED_R, 0); + analogWrite(PIN_LED_G, 0); + analogWrite(PIN_LED_B, 0); + + display.clear(); + display.setBrightness(15); + display.writeDisplay(); + + while (keyboard.available()) + keyboard.read(); + test_disarmed(1); + + //Pockame na pripojeni kabelu + display.print(0xCAB1, HEX); + display.writeDisplay(); + while (digitalRead(PIN_CABLE_CHECK)) + delay(100); + + //Pockame na odpojeni kabelu + display.clear(); + display.writeDisplay(); + while (!digitalRead(PIN_CABLE_CHECK)) + delay(100); + + //Odpocitavame + for (int cnt = TIME_COUNTDOWN; cnt >= 0 && !test_disarmed(0); cnt--) { + display.print(cnt_dec(cnt), DEC); + display.drawColon((cnt + 1) % 2); + display.writeDisplay(); + + analogWrite(PIN_LED_R, random(0, 3)); + analogWrite(PIN_LED_G, random(0, 3)); + analogWrite(PIN_LED_B, random(0, 3)); + + //Tikani / pipani + tone(PIN_COIL_LO, 1000, 50); + delay(60); + digitalWrite(PIN_COIL_LO, HIGH); + delay(40); + digitalWrite(PIN_COIL_LO, LOW); + + delay(900); + + } + + + while (!test_disarmed(0)) { + //Bomba vybouchla + int i; + + analogWrite(PIN_LED_R, random(0, 255)); + analogWrite(PIN_LED_G, random(0, 0)); + analogWrite(PIN_LED_B, random(0, 255)); + + for (i = 0; i < 10; i++) + display.writeDigitRaw(i, random(0, 255)); + display.setBrightness(random(0, 15)); + display.writeDisplay(); + + digitalWrite(PIN_COIL_HI, HIGH); + delay(20); + digitalWrite(PIN_COIL_HI, LOW); + int rnd = random(30, 100); + tone(PIN_COIL_LO, random(100, 8000), rnd); + delay(rnd); + } + + + //Bomba byla deaktivovana + tone(PIN_COIL_LO, 3000, 500); + delay(500); + tone(PIN_COIL_LO, 5000, 500); + analogWrite(PIN_LED_R, 0); + analogWrite(PIN_LED_G, 0); + analogWrite(PIN_LED_B, 0); + display.print(0xDEFD, HEX); + display.writeDisplay(); + delay(1000); + + + //Pockame na zmenu kabelu + char s = digitalRead(PIN_CABLE_CHECK); + while (digitalRead(PIN_CABLE_CHECK) == s) + delay(100); + +} diff --git a/arduino/Exit_Rum/old/exit-rum-display/exit-rum-display.ino b/arduino/Exit_Rum/old/exit-rum-display/exit-rum-display.ino new file mode 100644 index 0000000..68e420b --- /dev/null +++ b/arduino/Exit_Rum/old/exit-rum-display/exit-rum-display.ino @@ -0,0 +1,44 @@ +#include +#include +#include + +// Module connection pins (Digital Pins) +#define CLK 2 +#define DIO 3 + +TM1637Display display(CLK, DIO); + +// Set the LCD address to 0x27 for a 16 chars and 2 line display +LiquidCrystal_I2C lcd(0x3F, 16, 2); + +int i; + +void setup() +{ + // initialize the LCD + lcd.begin(); + + // Turn on the blacklight and print a message. + lcd.backlight(); + lcd.print("Rychta pyco!"); + + display.setBrightness(0x0f); + display.setColon(true); + display.showNumberDec(23); + + pinMode(8, OUTPUT); + pinMode(9, OUTPUT); + +} + +void loop() +{ + digitalWrite(8, HIGH); // turn the LED on (HIGH is the voltage level) + display.setColon(true); + display.showNumberDec(i); + delay(1000); + digitalWrite(8, LOW); // turn the LED off by making the voltage LOW + display.setColon(false); + display.showNumberDec(i++); + delay(1000); +}