Project showcase

DIS1417 (TIL311) Driven by Arduino © CC BY

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

  • 2,356 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 tutorial by LAGSILVA

  • 15,950 views
  • 1 comment
  • 40 respects

4-Stroke Digital Clock With Arduino

Project tutorial by LAGSILVA

  • 14,038 views
  • 16 comments
  • 44 respects

Stopwatch and Lap Timer with Arduino

Project tutorial by LAGSILVA

  • 20,694 views
  • 17 comments
  • 40 respects

Control a 7 Segment Display with a keypad!

Project tutorial by Isaac100

  • 16,272 views
  • 17 comments
  • 23 respects

Pressure Pad Interfacing with Arduino

Project tutorial by Ashish Kumar Senapati

  • 11,203 views
  • 2 comments
  • 15 respects

Multiple LED Display Module

by LAGSILVA

  • 5,378 views
  • 6 comments
  • 21 respects
Add projectSign up / Login