Project 19 8*16 dot matrix-light control

1.Project instruction

The light sensor feature that resistance is inverse proportion to to light intensity. Based on this characteristics, we made a night light. In this chapter, we will show you light column on dot matrix.

2.Project Principle

The signal pin of light sensor is linked with A6 of MAX development board. 8*16 dot matrix will show light column, the darker the light intensity is, the shorter the height of light column.

3.Project circuit

4.Project code

#include <Wire.h>
#include "Keyestudio_LEDBackpack.h"
#include "Keyestudio_GFX.h"
int mic = A7;
Keyestudio_8x16matrix matrix = Keyestudio_8x16matrix();
int Mic_val;

void setup() 
{
  Serial.begin(9600);
  Serial.println("16x8 LED Matrix Test");
  pinMode(mic,INPUT);
  matrix.begin(0x70);  // pass in the address
}

void loop() 
{
  Mic_val=analogRead(mic);
  Mic_val=map(Mic_val,0,1023,0,10);
  matrix.clear();
  matrix.drawCircle(3,8,Mic_val, LED_ON);
  matrix.writeDisplay();  // write the changes we just made to the display
  delay(10);
}