Alice Lau
Published

Anti-Gravity LED Matrix Hourglass

One historical day, Newton derived the law of universal gravitation from Kepler's law. In order to maintain this law ……

BeginnerFull instructions provided10
Anti-Gravity LED Matrix Hourglass

Things used in this project

Story

Read more

Code

hourglass-alice-final.ino

Arduino
#include "Grove_LED_Matrix_Driver_HT16K33.h"
#include <Wire.h>

//put your own design hex group here.
const uint64_t Emoji1[] =
{
  0xfffffefcf8f0e0c0,
  0xfffefcf8f0e0c080,
  0xfcf8f0e0c0800000,
  0xf8f0e0c080000000,
  0xf0e0c08000000000,
  0xe0c0800000000000,
  0xc080000000000000,
  0x8000000000000000,
};

const uint64_t Emoji2[] =
{
  0x0040001000040001,
  0xc0c0001000040001,
  0xc0c0001000040001,
  0xe0c0801000040001,
  0xf0e0c09000040001,
  0xf8f0e0d080040001,
  0xfefcf8f0e0c48001,
  0xfffffefcf8f0e0c0
};

const uint64_t Emoji3[] =
{
  0x8000200008000200,
  0x0040001000040103,
  0x8000200008010307,
  0x004000100107070f,
  0x0040001103070f1f,
  0x800021030f0f1f3f,
  0x800123070f1f3f7f,
  0x03070f1f3f7fffff
};

const uint64_t Emoji4[] =
{
  0x03070f1f3f7fffff,
  0x0103070f1f3f7fff,
  0x00000103070f1f3f,
  0x0000000103070f1f,
  0x000000000103070f,
  0x0000000000010307,
  0x0000000000000103,
  0x0000000000000001
};

Matrix_8x8 matrix_1;
Matrix_8x8 matrix_2;
//

void setup() {
  Wire.begin();
  matrix_1.init(0x70);
  matrix_1.setBrightness(0);
  matrix_1.setBlinkRate(BLINK_OFF);
  matrix_2.init(0x71);
  matrix_2.setBrightness(0);
  matrix_2.setBlinkRate(BLINK_OFF);
  pinMode(5, INPUT);
}

void loop() {
  
  if (digitalRead(5)==HIGH)
  {
    for (int i = 0; i < 8; i++)
    {
      if (digitalRead(5)==LOW)
      break;
      matrix_1.writeOnePicture(Emoji3[i]);
      matrix_1.display();
      delay(300);
      if (digitalRead(5)==LOW)
      break;
      matrix_2.writeOnePicture(Emoji4[i]);
      matrix_2.display();
      delay(300);
    }
  }else
  {
    for (int i = 0; i < 8; i++)
    {
      if (digitalRead(5)==HIGH)
      break;
      matrix_1.writeOnePicture(Emoji1[i]);
      matrix_1.display();
      delay(300);
      if (digitalRead(5)==HIGH)
      break;
      matrix_2.writeOnePicture(Emoji2[i]);
      matrix_2.display();
      delay(300);
    }
  }
}

Credits

Alice Lau

Alice Lau

0 projects • 0 followers
Seeed Studio Operation.

Comments

Add projectSign up / Login