Advertisement
pseud0_

Untitled

Sep 4th, 2022
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 90.42 KB | None | 0 0
  1. #include <MsTimer2.h>        //Internal timer2
  2. #include <PinChangeInt.h>    //This library file can make all pins on the REV4 board as external interrupts.  Define three-axis acceleration, three-axis gyroscope variables
  3. #include <MPU6050.h>      //MPU6050 Library
  4. #include <Wire.h>        //IIC communication library
  5.  
  6.  
  7. #include <SPI.h>
  8.  
  9. #include <Adafruit_GFX.h>
  10. #include <Adafruit_SSD1306.h>
  11.  
  12. //OLED
  13. #define SCREEN_WIDTH 128 // OLED display width, in pixels
  14. #define SCREEN_HEIGHT 64 // OLED display height, in pixels
  15. #define OLED_RESET     4 // Reset pin # (or -1 if sharing Arduino reset pin)  //from youtube
  16.  
  17. // Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
  18. #define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin)
  19. Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
  20.  
  21. //Sensor
  22. #define RIGHT A2
  23. #define LEFT A3
  24.  
  25. //Common Values/Variables
  26. int pos = 0;
  27.  
  28. const unsigned char opened_eye[] PROGMEM = {
  29.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  30.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  31.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  32.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  33.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  34.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  35.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  36.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  37.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  38.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  39.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  40.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  41.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  42.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  43.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  44.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  45.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  46.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  47.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  48.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, // ................##################################.............................##################################...............
  49.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, // ................##################################.............................##################################...............
  50.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, // ................##################################.............................##################################...............
  51.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, // ................##################################.............................##################################...............
  52.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, // ................##################################.............................##################################...............
  53.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, // ................##################################.............................##################################...............
  54.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, // ................##################################.............................##################################...............
  55.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, // ................##################################.............................##################################...............
  56.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, // ................##################################.............................##################################...............
  57.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, // ................##################################.............................##################################...............
  58.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, // ................##################################.............................##################################...............
  59.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, // ................##################################.............................##################################...............
  60.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, // ................##################################.............................##################################...............
  61.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, // ................##################################.............................##################################...............
  62.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, // ................##################################.............................##################################...............
  63.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, // ................##################################.............................##################################...............
  64.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, // ................##################################.............................##################################...............
  65.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, // ................##################################.............................##################################...............
  66.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, // ................##################################.............................##################################...............
  67.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, // ................#################################...............................#################################...............
  68.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  69.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  70.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  71.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  72.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  73.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  74.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  75.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  76.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  77.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  78.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  79.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  80.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  81.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  82.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  83.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  84.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  85.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  86.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  87.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  88.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  89.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  90.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  91.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  92.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // ................................................................................................................................
  93. };
  94.  
  95. const unsigned char semiopened_eye[] PROGMEM = {
  96.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  97.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  98.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  99.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  100.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  101.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  102.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  103.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  104.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  105.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  106.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  107.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  108.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  109.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  110.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  111.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  112.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  113.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  114.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  115.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  116.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  117.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  118.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, // ................................................................................................................................
  119.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, // ................................................................................................................................
  120.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, // ................##################################.............................##################################...............
  121.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, // ................##################################.............................##################################...............
  122.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, // ................##################################.............................##################################...............
  123.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, // ................##################################.............................##################################...............
  124.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, // ................##################################.............................##################################...............
  125.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, // ................##################################.............................##################################...............
  126.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, // ................##################################.............................##################################...............
  127.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, // ................##################################.............................##################################...............
  128.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, // ................##################################.............................##################################...............
  129.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, // ................##################################.............................##################################...............
  130.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, // ................##################################.............................##################################...............
  131.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  132.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  133.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  134.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  135.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  136.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  137.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  138.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  139.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  140.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  141.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  142.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  143.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  144.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  145.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  146.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  147.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  148.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  149.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  150.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  151.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  152.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  153.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  154.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  155.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  156.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  157.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  158.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  159.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // ................................................................................................................................
  160. };
  161.  
  162. const unsigned char closed_eye[] PROGMEM = {
  163.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  164.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  165.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  166.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  167.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  168.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  169.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  170.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  171.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  172.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  173.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  174.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  175.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  176.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  177.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  178.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  179.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  180.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  181.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  182.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  183.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  184.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  185.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  186.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  187.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  188.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  189.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  190.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, // ................##################################.............................##################################...............
  191.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, // ................##################################.............................##################################...............
  192.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, // ................##################################.............................##################################...............
  193.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  194.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  195.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  196.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  197.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  198.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  199.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  200.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  201.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  202.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  203.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  204.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  205.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  206.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  207.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  208.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  209.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  210.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  211.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  212.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  213.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  214.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  215.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  216.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  217.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  218.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  219.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  220.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  221.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  222.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  223.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  224.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  225.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  226.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // ................................................................................................................................
  227. };
  228.  
  229. const unsigned char rightLooking[] PROGMEM = {
  230.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  231.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  232.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  233.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  234.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  235.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  236.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  237.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  238.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  239.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  240.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  241.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  242.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  243.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  244.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  245.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  246.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  247.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  248.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  249.   0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xFF, 0xFF, 0xFF, 0x00, // ........................###############################..................................###############################........
  250.   0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xFF, 0xFF, 0xFF, 0x00, // ........................################################.................................###############################........
  251.   0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, // ........................################################................................################################........
  252.   0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFE, 0x00, // ........................###############################.................................###############################.........
  253.   0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFE, 0x00, // .......................################################.................................###############################.........
  254.   0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFE, 0x00, // .......................################################................................################################.........
  255.   0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFC, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFC, 0x00, // .......................###############################.................................###############################..........
  256.   0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFC, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFC, 0x00, // ......................################################.................................###############################..........
  257.   0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFC, 0x00, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFC, 0x00, // ......................################################................................################################..........
  258.   0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xF8, 0x00, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFC, 0x00, // ......................###############################.................................################################..........
  259.   0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xF8, 0x00, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xF8, 0x00, // ......................###############################.................................###############################...........
  260.   0x00, 0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xF8, 0x00, 0x00, 0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xF8, 0x00, // .....................################################................................################################...........
  261.   0x00, 0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xF8, 0x00, // .....................###############################.................................################################...........
  262.   0x00, 0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, // .....................###############################.................................###############################............
  263.   0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, // ....................################################................................################################............
  264.   0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xE0, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, // ....................###############################.................................################################............
  265.   0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xE0, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xE0, 0x00, // ....................###############################.................................###############################.............
  266.   0x00, 0x00, 0x1F, 0xFF, 0xFF, 0xFF, 0xE0, 0x00, 0x00, 0x00, 0x1F, 0xFF, 0xFF, 0xFF, 0xE0, 0x00, // ...................################################................................################################.............
  267.   0x00, 0x00, 0x1F, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x1F, 0xFF, 0xFF, 0xFF, 0xE0, 0x00, // ...................###############################.................................################################.............
  268.   0x00, 0x00, 0x1F, 0xFF, 0xFF, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x3F, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, // ...................##############################.................................################################..............
  269.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  270.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  271.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  272.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  273.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  274.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  275.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  276.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  277.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  278.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  279.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  280.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  281.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  282.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  283.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  284.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  285.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  286.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  287.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  288.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  289.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  290.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  291.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  292.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  293.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // ................................................................................................................................
  294. };
  295.  
  296. const unsigned char leftLooking[] PROGMEM = {
  297.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  298.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  299.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  300.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  301.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  302.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  303.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  304.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  305.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  306.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  307.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  308.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  309.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  310.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  311.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  312.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  313.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  314.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  315.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  316.   0x00, 0x3F, 0xFF, 0xFF, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x7F, 0xFF, 0xFF, 0xFF, 0x80, 0x00, 0x00, // ..........###############################................................################################.......................
  317.   0x00, 0x3F, 0xFF, 0xFF, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x7F, 0xFF, 0xFF, 0xFF, 0x80, 0x00, 0x00, // ..........###############################................................################################.......................
  318.   0x00, 0x1F, 0xFF, 0xFF, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x3F, 0xFF, 0xFF, 0xFF, 0x80, 0x00, 0x00, // ...........##############################.................................###############################.......................
  319.   0x00, 0x1F, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x3F, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, // ...........###############################................................################################......................
  320.   0x00, 0x1F, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x3F, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, // ...........###############################................................################################......................
  321.   0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x1F, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, // ............##############################.................................###############################......................
  322.   0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xE0, 0x00, 0x00, 0x00, 0x1F, 0xFF, 0xFF, 0xFF, 0xE0, 0x00, 0x00, // ............###############################................................################################.....................
  323.   0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xE0, 0x00, 0x00, 0x00, 0x1F, 0xFF, 0xFF, 0xFF, 0xE0, 0x00, 0x00, // ............###############################................................################################.....................
  324.   0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xE0, 0x00, 0x00, // .............###############################................................###############################.....................
  325.   0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, // .............###############################................................################################....................
  326.   0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, // .............###############################................................################################....................
  327.   0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xF8, 0x00, 0x00, 0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, // ..............###############################................................###############################....................
  328.   0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xF8, 0x00, 0x00, 0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xF8, 0x00, 0x00, // ..............###############################................................################################...................
  329.   0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xF8, 0x00, 0x00, 0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xF8, 0x00, 0x00, // ..............###############################................................################################...................
  330.   0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFC, 0x00, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xF8, 0x00, 0x00, // ...............###############################................................###############################...................
  331.   0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFC, 0x00, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFC, 0x00, 0x00, // ...............###############################................................################################..................
  332.   0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFC, 0x00, 0x00, // ...............################################...............................################################..................
  333.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFE, 0x00, 0x00, // ................###############################................................################################.................
  334.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFE, 0x00, 0x00, // ................###############################................................################################.................
  335.   0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFE, 0x00, 0x00, // ................################################...............................################################.................
  336.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  337.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  338.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  339.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  340.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  341.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  342.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  343.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  344.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  345.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  346.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  347.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  348.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  349.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  350.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  351.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  352.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  353.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  354.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  355.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  356.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  357.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  358.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  359.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................................................................................................................................
  360.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // ................................................................................................................................
  361. };
  362.  
  363. void blink_eye() {
  364.   display.clearDisplay();
  365.   display.drawBitmap(0, 0, opened_eye, 128, 64, WHITE);
  366.   display.display();
  367.  
  368.   display.clearDisplay();
  369.   display.drawBitmap(0, 0, semiopened_eye, 128, 64, WHITE);
  370.   display.display();
  371.  
  372.   display.clearDisplay();
  373.   display.drawBitmap(0, 0, closed_eye, 128, 64, WHITE);
  374.   display.display();
  375.  
  376.   display.clearDisplay();
  377.   display.drawBitmap(0, 0, semiopened_eye, 128, 64, WHITE);
  378.   display.display();
  379.  
  380.   display.clearDisplay();
  381.   display.drawBitmap(0, 0, opened_eye, 128, 64, WHITE);
  382.   display.display();
  383.   delay(1000);
  384. }
  385.  
  386. void lookleft() {
  387.   display.clearDisplay();
  388.   display.drawBitmap(0, 0, opened_eye, 128, 64, WHITE);
  389.   display.display();
  390.  
  391.   display.clearDisplay();
  392.   display.drawBitmap(0, 0, closed_eye, 128, 64, WHITE);
  393.   display.display();
  394.  
  395.   display.clearDisplay();
  396.   display.drawBitmap(0, 0, leftLooking, 128, 64, WHITE);
  397.   display.display();
  398.   delay(1000);
  399.  
  400.   display.clearDisplay();
  401.   display.drawBitmap(0, 0, closed_eye, 128, 64, WHITE);
  402.   display.display();
  403.  
  404.   display.clearDisplay();
  405.   display.drawBitmap(0, 0, opened_eye, 128, 64, WHITE);
  406.   display.display();
  407. }
  408.  
  409. void lookright() {
  410.   display.clearDisplay();
  411.   display.drawBitmap(0, 0, opened_eye, 128, 64, WHITE);
  412.   display.display();
  413.  
  414.   display.clearDisplay();
  415.   display.drawBitmap(0, 0, closed_eye, 128, 64, WHITE);
  416.   display.display();
  417.  
  418.   display.clearDisplay();
  419.   display.drawBitmap(0, 0, rightLooking, 128, 64, WHITE);
  420.   display.display();
  421.   delay(1000);
  422.  
  423.   display.clearDisplay();
  424.   display.drawBitmap(0, 0, closed_eye, 128, 64, WHITE);
  425.   display.display();
  426.  
  427.   display.clearDisplay();
  428.   display.drawBitmap(0, 0, opened_eye, 128, 64, WHITE);
  429.   display.display();
  430. }
  431.  
  432.  
  433. void eyeMoves() {
  434.   blink_eye();
  435.   lookright(); lookright();
  436.   blink_eye();
  437.   lookleft(); lookleft();
  438.   blink_eye();
  439.   lookright(); lookright();
  440.   blink_eye();
  441.   lookleft(); lookleft();
  442.   blink_eye();
  443.  
  444. }
  445.  
  446. MPU6050 mpu6050;     // Instantiate an MPU6050 object; name mpu6050
  447. int16_t ax, ay, az, gx, gy, gz;     //Define three-axis acceleration, three-axis gyroscope variables
  448.  
  449. //TB6612 pins definition
  450. const int right_R1 = 8;
  451. const int right_R2 = 12;
  452. const int PWM_R = 10;
  453. const int left_L1 = 7;
  454. const int left_L2 = 6;
  455. const int PWM_L = 9;
  456.  
  457. const int buz = 11;
  458. const int btn = 13;
  459.  
  460. ///////////////////////angle parameters//////////////////////////////
  461. float angle_X; // calculate the inclined angle variable of X-axis by accelerometer
  462. float angle_Y; //calculate the inclined angle variable of Y-axis by accelerometer
  463. float angle0 = 0; //mechanical balance angle (ideally 0 degrees)
  464. float Gyro_x, Gyro_y, Gyro_z; //Angular angular velocity by gyroscope calculation
  465. ///////////////////////angle parameter//////////////////////////////
  466.  
  467. ///////////////////////Kalman_Filter////////////////////////////
  468. float Q_angle = 0.001;  //Covariance of gyroscope noise
  469. float Q_gyro = 0.003;    // Covariance of gyroscope drift noise
  470. float R_angle = 0.5;    //Covariance of accelerometer
  471. char C_0 = 1;
  472. float dt = 0.005; //The value of dt is the filter sampling time
  473. float K1 = 0.05; // a function containing the Kalman gain is used to calculate the deviation of the optimal estimate
  474. float K_0, K_1, t_0, t_1;
  475. float angle_err;
  476. float q_bias;    //gyroscope drift
  477.  
  478. float accelz = 0;
  479. float angle;
  480. float angleY_one;
  481. float angle_speed;
  482.  
  483. float Pdot[4] = { 0, 0, 0, 0};
  484. float P[2][2] = {{ 1, 0 }, { 0, 1 }};
  485. float  PCt_0, PCt_1, E;
  486. //////////////////////Kalman_Filter/////////////////////////
  487.  
  488. //////////////////////PID parameter///////////////////////////////
  489. double kp = 34, ki = 0, kd = 0.62;                   //angle loop parameter
  490. double kp_speed = 3.56, ki_speed = 0.072, kd_speed = 0;   // speed loop parameter
  491. double kp_turn = 24, ki_turn = 0, kd_turn = 0.08;                 // steering loop parameter
  492. double setp0 = 0; //angle balance point
  493. int PD_pwm;  //angle output
  494. float pwm1 = 0, pwm2 = 0;
  495.  
  496. //////////////////interrupt speed count/////////////////////////////
  497. #define PinA_left 5  //external interrupt
  498. #define PinA_right 4   //external interrupt
  499. volatile long count_right = 0;//Used to calculate the pulse value calculated by the Hall encoder (the volatile long type is to ensure the value is valid)
  500. volatile long count_left = 0;
  501. int speedcc = 0;
  502. //////////////////////pulse count/////////////////////////
  503. int lz = 0;
  504. int rz = 0;
  505. int rpluse = 0;
  506. int lpluse = 0;
  507. int pulseright, pulseleft;
  508. ////////////////////////////////PI variable parameter//////////////////////////
  509. float speeds_filterold = 0;
  510. float positions = 0;
  511. int flag1;
  512. double PI_pwm;
  513. int cc;
  514. int speedout;
  515. float speeds_filter;
  516.  
  517. //////////////////////////////turning PD///////////////////
  518. int turnmax, turnmin, turnout;
  519. float Turn_pwm = 0;
  520. int zz = 0;
  521. int turncc = 0;
  522.  
  523. //Bluetooth//
  524. int front = 0;//forward variable
  525. int back = 0;//backward
  526. int left = 0;//turn left
  527. int right = 0;//turn right
  528. char val;
  529.  
  530. int i, button;
  531.  
  532. void setup()
  533. {
  534.  
  535.   // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
  536.   if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
  537.     Serial.println(F("SSD1306 allocation failed"));
  538.     //for (;;); // Don't proceed, loop forever  //fiverr
  539.   }
  540.  
  541.   // Show initial display buffer contents on the screen --
  542.   // the library initializes this with an Adafruit splash screen.
  543.  
  544.  
  545.   //  display.display();  //fiverr
  546.   //  delay(2000); // Pause for 2 seconds //fiverr
  547.  
  548.   // Clear the buffer
  549.   display.clearDisplay();
  550.  
  551.   pinMode(RIGHT, INPUT);
  552.   pinMode(LEFT, INPUT);
  553.  
  554.   //  display.setTextSize(2);
  555.   //  display.setTextColor(WHITE);
  556.   //  display.setCursor(0, 0);
  557.   //  // Display static text
  558.   //  display.println(" Balance");
  559.   //  display.setCursor(0, 20);
  560.   //  display.println(" CAR ");
  561.   //  display.display();
  562.  
  563.  
  564.  
  565.   //set the motor control pins to OUTPUT
  566.   pinMode(right_R1, OUTPUT);
  567.   pinMode(right_R2, OUTPUT);
  568.   pinMode(left_L1, OUTPUT);
  569.   pinMode(left_L2, OUTPUT);
  570.   pinMode(PWM_R, OUTPUT);
  571.   pinMode(PWM_L, OUTPUT);
  572.  
  573.   //assign the initial state value
  574.   digitalWrite(right_R1, 1);
  575.   digitalWrite(right_R2, 0);
  576.   digitalWrite(left_L1, 0);
  577.   digitalWrite(left_L2, 1);
  578.   analogWrite(PWM_R, 0);
  579.   analogWrite(PWM_L, 0);
  580.  
  581.   pinMode(PinA_left, INPUT);  //speed encoder input
  582.   pinMode(PinA_right, INPUT);
  583.  
  584.   pinMode(btn, INPUT);
  585.   pinMode(buz, OUTPUT);
  586.  
  587.   // join I2C bus
  588.   Wire.begin();                            //join I2C bus sequence
  589.   Serial.begin(9600);                       //open the serial monitor and set the baud rate to 9600
  590.   delay(1500);
  591.   mpu6050.initialize();                       //initialize MPU6050
  592.   delay(2);
  593.  
  594.   //5ms; use timer2 to set the timer interrupt (note: using timer2 may affects the PWM output of pin3 pin11)
  595.   MsTimer2::set(5, DSzhongduan);    //5ms; execute the function DSzhongduan once
  596.   MsTimer2::start();    //start interrupt
  597.  
  598.   //external interrupt; used to calculate the wheel speed
  599.   attachPinChangeInterrupt(PinA_left, Code_left, CHANGE);          //PinA_left Level change triggers the external interrupt; execute the subfunction Code_left
  600.   attachPinChangeInterrupt(PinA_right, Code_right, CHANGE);       //PinA_right Level change triggers the external interrupt; execute the subfunction Code_right
  601.  
  602. }
  603.  
  604. //buzzer
  605. void buzzer()
  606. {
  607.   for (int i = 0; i < 50; i++)
  608.   {
  609.     digitalWrite(buz, HIGH);
  610.     delay(1);
  611.     digitalWrite(buz, LOW);
  612.     delay(1);
  613.   }
  614.   delay(50);
  615.   for (int i = 0; i < 50; i++)
  616.   {
  617.     digitalWrite(buz, HIGH);
  618.     delay(1);
  619.     digitalWrite(buz, LOW);
  620.     delay(1);
  621.   }
  622. }
  623.  
  624. void loop()
  625. {
  626.   //OLED
  627.  
  628.   blink_eye();
  629.   lookright(); lookright();
  630.   blink_eye();
  631.   lookleft(); lookleft();
  632.   blink_eye();
  633.   lookright(); lookright();
  634.   blink_eye();
  635.   lookleft(); lookleft();
  636.   blink_eye();
  637.  
  638.  
  639.   //Serial.println(angle0);
  640.   //Serial.print("angle= ");
  641.   //Serial.println(angle);
  642.   //delay(1);
  643.   //Serial.println(PD_pwm);
  644.   //Serial.println(pwm1);
  645.   //Serial.println(pwm2);
  646.   //Serial.print("pulseright = ");
  647.   //Serial.println(pulseright);
  648.   //Serial.print("pulseleft = ");
  649.   //Serial.println(pulseleft);
  650.   //Serial.println(PI_pwm);
  651.   //Serial.println(speeds_filter);
  652.   //Serial.println (positions);
  653.   //Serial.println(Turn_pwm);
  654.   //Serial.println(Gyro_z);
  655.   //Serial.println(Turn_pwm);
  656.  
  657.   if (i < 1)
  658.   {
  659.     button = digitalRead(btn);
  660.     if (button == 0)
  661.     {
  662.       angle0 = -angle;
  663.       //Serial.println(angle0);
  664.       buzzer();
  665.       i++;
  666.     }
  667.   }
  668.   if (Serial.available())
  669.   {
  670.     val = Serial.read();      //assign the value read from the serial port to val
  671.     //Serial.println(val);
  672.     switch (val)            //switch statement
  673.     {
  674.       case 'F': front = 250; break;     //if val equals F,front=250,car will move forward
  675.       case 'B': back = -250; break;     //go back
  676.       case 'L': left = 1; break;  //turn left
  677.       case 'R': right = 1; break;                       //turn right
  678.       case 'S': front = 0, back = 0, left = 0, right = 0; break; //stop
  679.       case 'D': Serial.print(angle); break;
  680.     }
  681.   }
  682.  
  683. }
  684.  
  685. /////////////////////Hall count/////////////////////////
  686. //left speed encoder count
  687. void Code_left()
  688. {
  689.   count_left ++;
  690. }
  691. //right speed encoder count
  692. void Code_right()
  693. {
  694.   count_right ++;
  695. }
  696. ////////////////////pulse count///////////////////////
  697. void countpluse()
  698. {
  699.   lz = count_left;     //assign the value counted by encoder to lz
  700.   rz = count_right;
  701.  
  702.   count_left = 0;     //Clear count quantity
  703.   count_right = 0;
  704.  
  705.   lpluse = lz;
  706.   rpluse = rz;
  707.  
  708.   if ((pwm1 < 0) && (pwm2 < 0))                     //judge the car’s moving direction; if backward (PWM namely motor voltage is negative), pulse is a negative number.
  709.   {
  710.     rpluse = -rpluse;
  711.     lpluse = -lpluse;
  712.   }
  713.   else if ((pwm1 > 0) && (pwm2 > 0))                 //if backward (PWM namely motor voltage is positive), pulse is a positive number.
  714.   {
  715.     rpluse = rpluse;
  716.     lpluse = lpluse;
  717.   }
  718.   else if ((pwm1 < 0) && (pwm2 > 0))                 //judge the car’s moving direction; if turn left, right pulse is a positive number; left pulse is a negative number.
  719.   {
  720.     rpluse = rpluse;
  721.     lpluse = -lpluse;
  722.   }
  723.   else if ((pwm1 > 0) && (pwm2 < 0))               //judge the car’s moving direction; if turn right, right pulse is a negative number; left pulse is a positive number.
  724.   {
  725.     rpluse = -rpluse;
  726.     lpluse = lpluse;
  727.   }
  728.  
  729.   // enter interrupt per 5ms,pulse number plus
  730.   pulseright += rpluse;
  731.   pulseleft += lpluse;
  732. }
  733.  
  734. /////////////////////////////////interrupt ////////////////////////////
  735. void DSzhongduan()
  736. {
  737.   sei();  //allow overall interrupt
  738.   countpluse();        //pulse plus subfunction
  739.   mpu6050.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);     //IIC to get MPU6050 six-axis data  ax ay az gx gy gz
  740.   angle_calculate(ax, ay, az, gx, gy, gz, dt, Q_angle, Q_gyro, R_angle, C_0, K1);      //get angle and Kalmam filtering
  741.   PD();         //angle loop PD control
  742.   anglePWM();
  743.  
  744.   cc++;
  745.   if (cc >= 8)  //5*8=40,enter PI algorithm of speed per 40ms
  746.   {
  747.     speedpiout();
  748.     cc = 0; //Clear
  749.   }
  750.   turncc++;
  751.   if (turncc > 4)    //20ms; enter PD algorithm of steering
  752.   {
  753.     turnspin();
  754.     turncc = 0;   //Clear
  755.   }
  756. }
  757. ///////////////////////////////////////////////////////////
  758.  
  759. /////////////////////////////tilt calculation///////////////////////
  760. void angle_calculate(int16_t ax, int16_t ay, int16_t az, int16_t gx, int16_t gy, int16_t gz, float dt, float Q_angle, float Q_gyro, float R_angle, float C_0, float K1)
  761. {
  762.   float Angle = -atan2(ay , az) * (180 / PI);          //Radial rotation angle calculation formula ; negative sign is direction processing
  763.   Gyro_x = -gx / 131;              //The X-axis angular velocity calculated by the gyroscope;  the negative sign is the direction processing
  764.   Kalman_Filter(Angle, Gyro_x);            //Kalman Filter
  765.   //rotating angle Z-axis parameter
  766.   Gyro_z = -gz / 131;                      //angle speed of Z-axis
  767.   //accelz = az / 1604;
  768.  
  769.   float angleAx = -atan2(ax, az) * (180 / PI); //calculate the inclined angle with x-axis
  770.   Gyro_y = -gy / 131.00; //angle speed of Y-axis
  771.   Yiorderfilter(angleAx, Gyro_y); //first-order filtering
  772. }
  773. ////////////////////////////////////////////////////////////////
  774.  
  775. ///////////////////////////////KalmanFilter/////////////////////
  776. void Kalman_Filter(double angle_m, double gyro_m)
  777. {
  778.   angle += (gyro_m - q_bias) * dt;          //prior estimate
  779.   angle_err = angle_m - angle;
  780.  
  781.   Pdot[0] = Q_angle - P[0][1] - P[1][0];    //The differential of the covariance of the prior estimate error
  782.   Pdot[1] = - P[1][1];
  783.   Pdot[2] = - P[1][1];
  784.   Pdot[3] = Q_gyro;
  785.  
  786.   P[0][0] += Pdot[0] * dt;    //The integral of the covariance differential of the prior estimate error
  787.   P[0][1] += Pdot[1] * dt;
  788.   P[1][0] += Pdot[2] * dt;
  789.   P[1][1] += Pdot[3] * dt;
  790.  
  791.   //Intermediate variables in matrix multiplication
  792.   PCt_0 = C_0 * P[0][0];
  793.   PCt_1 = C_0 * P[1][0];
  794.   //denominator
  795.   E = R_angle + C_0 * PCt_0;
  796.   //gain value
  797.   K_0 = PCt_0 / E;
  798.   K_1 = PCt_1 / E;
  799.  
  800.   t_0 = PCt_0;  //Intermediate variables in matrix multiplication
  801.   t_1 = C_0 * P[0][1];
  802.  
  803.   P[0][0] -= K_0 * t_0;    //Posterior estimation error covariance
  804.   P[0][1] -= K_0 * t_1;
  805.   P[1][0] -= K_1 * t_0;
  806.   P[1][1] -= K_1 * t_1;
  807.  
  808.   q_bias += K_1 * angle_err;    //Posterior estimate
  809.   angle_speed = gyro_m - q_bias;   //The differential of the output value gives the optimal angular velocity
  810.   angle += K_0 * angle_err; ////Posterior estimation; get the optimal angle
  811. }
  812.  
  813. /////////////////////first-order filter/////////////////
  814. void Yiorderfilter(float angle_m, float gyro_m)
  815. {
  816.   angleY_one = K1 * angle_m + (1 - K1) * (angleY_one + gyro_m * dt);
  817. }
  818.  
  819. //////////////////angle PD////////////////////
  820. void PD()
  821. {
  822.   PD_pwm = kp * (angle + angle0) + kd * angle_speed; //PD angle loop control
  823. }
  824.  
  825. //////////////////speed PI////////////////////
  826. void speedpiout()
  827. {
  828.   float speeds = (pulseleft + pulseright) * 1.0;      //speed  pulse value
  829.   pulseright = pulseleft = 0;      //clear
  830.   speeds_filterold *= 0.7;         //first-order complementary filtering
  831.   speeds_filter = speeds_filterold + speeds * 0.3;
  832.   speeds_filterold = speeds_filter;
  833.   positions += speeds_filter;
  834.   positions += front;             //Forward control fusion
  835.   positions += back;              //backward control fusion
  836.   positions = constrain(positions, -3550, 3550);   //Anti-integral saturation
  837.   PI_pwm = ki_speed * (setp0 - positions) + kp_speed * (setp0 - speeds_filter);      //speed loop control PI
  838. }
  839. //////////////////speed PI////////////////////
  840.  
  841. ///////////////////////////turning/////////////////////////////////
  842. void turnspin()
  843. {
  844.   int flag = 0;      //
  845.   float turnspeed = 0;
  846.   float rotationratio = 0;
  847.  
  848.   if (left == 1 || right == 1)
  849.   {
  850.     if (flag == 0)                             //judge the speed before rotate, to increase the flexibility
  851.     {
  852.       turnspeed = ( pulseright + pulseleft);                      //current speed ; express in pulse
  853.       flag = 1;
  854.     }
  855.     if (turnspeed < 0)                                 //speed absolute value
  856.     {
  857.       turnspeed = -turnspeed;
  858.     }
  859.     if (left == 1 || right == 1)  //if press left key or right key
  860.     {
  861.       turnmax = 3;        //max turning value
  862.       turnmin = -3;       //min turning value
  863.     }
  864.     rotationratio = 5 / turnspeed;          //speed setting value
  865.     if (rotationratio < 0.5)
  866.     {
  867.       rotationratio = 0.5;
  868.     }
  869.  
  870.     if (rotationratio > 5)
  871.     {
  872.       rotationratio = 5;
  873.     }
  874.   }
  875.   else
  876.   {
  877.     rotationratio = 0.5;
  878.     flag = 0;
  879.     turnspeed = 0;
  880.   }
  881.   if (left == 1) //plus according to direction parameter
  882.   {
  883.     turnout += rotationratio;
  884.   }
  885.   else if (right == 1 )//plus according to direction parameter
  886.   {
  887.     turnout -= rotationratio;
  888.   }
  889.   else turnout = 0;
  890.   if (turnout > turnmax)   turnout = turnmax;//max value of amplitude
  891.   if (turnout < turnmin)   turnout = turnmin;//min value of amplitude
  892.  
  893.   Turn_pwm = -turnout * kp_turn - Gyro_z * kd_turn;//turning PD algorithm control
  894. }
  895. ///////////////////////////turning/////////////////////////////////
  896.  
  897. ////////////////////////////PWM end value/////////////////////////////
  898. void anglePWM()
  899. {
  900.   pwm2 = -PD_pwm - PI_pwm + Turn_pwm;         //assign the end value of PWM to motor
  901.   pwm1 = -PD_pwm - PI_pwm - Turn_pwm;
  902.  
  903.   if (pwm1 > 255)          //limit PWM value not greater than255
  904.   {
  905.     pwm1 = 255;
  906.   }
  907.   if (pwm1 < -255)
  908.   {
  909.     pwm1 = -255;
  910.   }
  911.   if (pwm2 > 255)
  912.   {
  913.     pwm2 = 255;
  914.   }
  915.   if (pwm2 < -255)
  916.   {
  917.     pwm2 = -255;
  918.   }
  919.  
  920.   if (angle > 45 || angle < -45) //if tilt angle is greater than 45°,motor will stop
  921.   {
  922.     pwm1 = pwm2 = 0;
  923.   }
  924.  
  925.   if (pwm2 >= 0)      //determine the motor steering and speed by negative and positive of PWM
  926.   {
  927.     digitalWrite(left_L1, LOW);
  928.     digitalWrite(left_L2, HIGH);
  929.     analogWrite(PWM_L, pwm2);
  930.   }
  931.   else
  932.   {
  933.     digitalWrite(left_L1, HIGH);
  934.     digitalWrite(left_L2, LOW);
  935.     analogWrite(PWM_L, -pwm2);
  936.   }
  937.  
  938.   if (pwm1 >= 0)
  939.   {
  940.     digitalWrite(right_R1, LOW);
  941.     digitalWrite(right_R2, HIGH);
  942.     analogWrite(PWM_R, pwm1);
  943.   }
  944.   else
  945.   {
  946.     digitalWrite(right_R1, HIGH);
  947.     digitalWrite(right_R2, LOW);
  948.     analogWrite(PWM_R, -pwm1);
  949.   }
  950. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement