Arduino HC-04 and 8x8 Matrix MAX7219

Arduino HC-04 and 8x8 Matrix MAX7219 © GPL3+

Get close and the Arduino is happy; go away and he gets sad.

  • 6,205 views
  • 4 comments
  • 11 respects

Components and supplies

Apps and online services

About this project

A super easy project with Arduino and LED matrix - for the Arduino to stay happy, it just needs to be approached.

Download library:

Code

CODE FULLC/C++
// PIN 6 = TRIG
// PIN 5 = ECHO
// DIN = 8
// CS = 9
// CLK = 10
// MADE BY VINICIUS LOPES
#include <Ultrasonic.h>
#include "LedControl.h"
#include "binary.h"
Ultrasonic sensor (6,5);// PIN 6 = TRIG // PIN 5 = ECHO
LedControl lc = LedControl(8,10,9,1);// DIN = 8  // CS = 9 // CLK = 10

unsigned long delaytime=1000;
// PIN 6 = TRIG // PIN 5 = ECHO
// DIN = 8  // CS = 9 // CLK = 10

byte ff[8]= {
  
B00111100,
B01000010,
B10010101,
B10100001,
B10100001,
B10010101,
B01000010,
B00111100


};

byte ft[8]= {
B00111100,
B01000010,
B10100101,
B10010001,
B10010001,
B10100101,
B01000010,
B00111100};

void setup() {
  lc.shutdown(0,false);
  lc.setIntensity(0,8);
  lc.clearDisplay(0);  
}

void desenhaFaces(){


}

void loop(){
  
  int dist = sensor.Ranging(CM);
  if(dist<30){
      lc.setRow(0,0,ff[0]);
  lc.setRow(0,1,ff[1]);
  lc.setRow(0,2,ff[2]);
  lc.setRow(0,3,ff[3]);
  lc.setRow(0,4,ff[4]);
  lc.setRow(0,5,ff[5]);
  lc.setRow(0,6,ff[6]);
  lc.setRow(0,7,ff[7]);

  }else{
      lc.setRow(0,0,ft[0]);
  lc.setRow(0,1,ft[1]);
  lc.setRow(0,2,ft[2]);
  lc.setRow(0,3,ft[3]);
  lc.setRow(0,4,ft[4]);
  lc.setRow(0,5,ft[5]);
  lc.setRow(0,6,ft[6]);
  lc.setRow(0,7,ft[7]);

  }delay(100);

  
  
}

Schematics

hardware
// PIN 6 = TRIG
// PIN 5 = ECHO
// DIN = 8
// CS = 9
// CLK = 10
Untitled sketch bb smhln10mnb

Comments

Similar projects you might like

Programming 8x8 LED Matrix

by SAnwandter1

  • 114,263 views
  • 26 comments
  • 105 respects

8x8 Matrix LED Snake Game (Smartphone Motion)

Project tutorial by hmkim

  • 4,578 views
  • 2 comments
  • 17 respects

8X8 Matrix LED Snake Game (HTML5 Web Socket)

Project showcase by hmkim

  • 5,396 views
  • 1 comment
  • 14 respects

Remote-Controlled 8x8 LED Matrix

Project showcase by hmkim

  • 4,421 views
  • 6 comments
  • 27 respects

8x8 Dot Matrix

Project tutorial by robocircuits

  • 1,062 views
  • 0 comments
  • 4 respects
Add projectSign up / Login