Project showcase

DIS1417 (TIL311) Driven by Arduino © CC BY

How to drive old binary input HEX LED display with Arduino.

  • 2,093 views
  • 2 comments
  • 6 respects

Components and supplies

Apps and online services

About this project

How to drive old binary input HEX LED display with Arduino; the attached sketch is capable to drive up to six display. The connection instructions are commented in the code.

Enjoy!

Code

TIL311 six display multiplexerArduino
//TIL311 display multiplexer


#include <Average.h>
// Arduino pins connected to the 4511
const uint8_t LedA = 2;
const uint8_t LedB = 3;
const uint8_t LedC = 4;
const uint8_t LedD = 5;

// Arduino pins connected to the segment driver transistors
const uint8_t Led1 = 6;
const uint8_t Led2 = 7;
const uint8_t Led3 = 8;
const uint8_t Led4 = 9;
const uint8_t Led5 = 10;
const uint8_t Led6 = 11;

Average<float> avemeas(10);
float measavg = 0;
static int d = 10;


void setup()
{
  // Let the Arduino know which pins go where
  pinMode(LedA, OUTPUT);
  pinMode(LedB, OUTPUT);
  pinMode(LedC, OUTPUT);
  pinMode(LedD, OUTPUT);

  pinMode(Led1, OUTPUT);
  pinMode(Led2, OUTPUT);
  pinMode(Led3, OUTPUT);
  pinMode(Led4, OUTPUT);
  pinMode(Led5, OUTPUT);
  pinMode(Led6, OUTPUT);

  digitalWrite(Led1, LOW);
  digitalWrite(Led2, LOW);
  digitalWrite(Led3, LOW);
  digitalWrite(Led4, LOW);
  digitalWrite(Led5, LOW);
  digitalWrite(Led6, LOW);


}

void loop()

{
//  double measavg = 999999;
  float meas = analogRead(2) / 1023.00 * 1000.00;
// float meas = bme.readTemperature() * 100;
  avemeas.push(meas);
  measavg = avemeas.mean();
  print_number(measavg);

}

void print_number(long n) {

  set_digit(Led1, d, n/100000);
  set_digit(Led2, d, n/10000 );
  set_digit(Led3, d, n/1000  );
  set_digit(Led4, d, n/100   );
  set_digit(Led5, d, n/10    );
  set_digit(Led6, d, n/1     );  
}

void set_digit(const uint8_t led, const long d, const long value) {
  set_number(value);
  digitalWrite(led, LOW);
  delay(d);
  digitalWrite(led, HIGH);
}

void set_number(const long n) {
  static const struct number {
    uint8_t d;
    uint8_t c;
    uint8_t b;
    uint8_t a;
  } numbers[] = {
    { LOW,  LOW,  LOW,  LOW}, /* 0 */
    { LOW,  LOW,  LOW, HIGH}, /* 1 */
    { LOW,  LOW, HIGH,  LOW}, /* 2 */
    { LOW,  LOW, HIGH, HIGH}, /* 3 */
    { LOW, HIGH,  LOW,  LOW}, /* 4 */
    { LOW, HIGH,  LOW, HIGH}, /* 5 */
    { LOW, HIGH, HIGH,  LOW}, /* 6 */
    { LOW, HIGH, HIGH, HIGH}, /* 7 */
    {HIGH,  LOW,  LOW,  LOW}, /* 8 */
    {HIGH,  LOW,  LOW, HIGH}, /* 9 */
    {HIGH,  LOW,  HIGH, LOW}, /* A */
    {HIGH,  LOW,  HIGH, HIGH}, /* B */
    {HIGH,  HIGH,  LOW, LOW}, /* C */
    {HIGH,  HIGH,  LOW, HIGH}, /* D */
    {HIGH,  HIGH,  HIGH, LOW}, /* E */
    {HIGH,  HIGH,  HIGH, HIGH}, /* F */  
  };
  
  digitalWrite(LedA, numbers[n%10].a);
  digitalWrite(LedB, numbers[n%10].b);
  digitalWrite(LedC, numbers[n%10].c);
  digitalWrite(LedD, numbers[n%10].d);
}

Comments

Similar projects you might like

Digital Clock with Mirrored Display Driven by Accelerometers

Project showcase by LAGSILVA

  • 14,365 views
  • 1 comment
  • 38 respects

4-Stroke Digital Clock With Arduino

Project showcase by LAGSILVA

  • 11,105 views
  • 9 comments
  • 39 respects

Current Temperature on 8*8 LED Dot Matrix

Project showcase by Nekhil ravi

  • 10,213 views
  • 13 comments
  • 34 respects

Digital & Binary Clock In 8 Digits x 7 Segments LED Display

Project showcase by LAGSILVA

  • 1,827 views
  • 2 comments
  • 9 respects

Arduino Color Mixer

Project tutorial by Ahmed Hamdy

  • 14,778 views
  • 6 comments
  • 59 respects

Analog Clock with LED Matrix and Arduino

Project tutorial by LAGSILVA

  • 12,237 views
  • 8 comments
  • 39 respects
Add projectSign up / Login