#include <LEDMatrixDriver.hpp>
//
// Simple 'animation'
//
// CLK -> Arduino pin 13
// CS -> Arduino pin 10
// DIN -> Arduino pin 11
//
const uint8_t LEDMATRIX_CS_PIN = 10;
// Number of 8x8 segments you are connecting
const int LEDMATRIX_SEGMENTS = 1;
const int LEDMATRIX_WIDTH = LEDMATRIX_SEGMENTS * 8;
// The LEDMatrixDriver class instance
LEDMatrixDriver lmd(LEDMATRIX_SEGMENTS, LEDMATRIX_CS_PIN);
void setup() {
//
// Use Setup for initializations
//
lmd.setEnabled(true);
Serial.begin(9600);
pinMode(A0, OUTPUT);
pinMode(A5, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(A0, HIGH);
delayMicroseconds(10);
digitalWrite(A0, LOW);
// Read the result:
int duration = pulseIn(A5, HIGH);
Serial.print("Distance in CM: ");
Serial.println(duration / 58);
delay(1000);
}