Skip to content

Commit

Permalink
Add files
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonPucheu authored Dec 8, 2022
1 parent 6bbefd4 commit 4218352
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 0 deletions.
26 changes: 26 additions & 0 deletions keywords.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#######################################
# Syntax Coloring Map
#######################################

#######################################
# Datatypes (KEYWORD1)
#######################################

Digit KEYWORD1

#######################################
# Methods and Functions (KEYWORD2)
#######################################

display KEYWORD2

#######################################
# Variables (KEYWORD3)
#######################################

pin1 KEYWORD3
pin2 KEYWORD3

######################################
# Constants (LITERAL1)
#######################################
11 changes: 11 additions & 0 deletions library.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name=Digit
version=1.0.0
author=Simon Pucheu
maintainer=Simon Pucheu
sentence=None
paragraph=None
category=Sensors
url=https://github.com/IngeniumTeam/Digit
architectures=avr
includes=Digit.h
depends=
21 changes: 21 additions & 0 deletions src/Digit.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include <Arduino.h>

#include "Digit.h"

Digit::Digit(uint8_t iPin1, uint8_t iPin2, int brightness = 5)
{
pin1 = iPin1;
pin2 = iPin2;
pinMode(pin1, OUTPUT);
pinMode(pin2, OUTPUT);
digit = TM1637Display(pin1, pin2);
digit.setBrightness(brightness);
}

/**
* Display a number on the digit display
*/
void Digit::display(int number)
{
digit.showNumberDec(number, true);
}
12 changes: 12 additions & 0 deletions src/Digit.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include <Arduino.h>
#include <TM1637Display.h>

class Digit
{
public:
Digit(uint8_t iPin1, uint8_t iPin2, int brightness = 5);
void display(int number);
uint8_t pin1;
uint8_t pin2;
TM1637Display digit = TM1637Display(0, 0);
};

0 comments on commit 4218352

Please sign in to comment.