1.0.3 • Published 4 years ago

segmentdisplay v1.0.3

Weekly downloads
13
License
-
Repository
-
Last release
4 years ago

temperature console printer

temperature console printer is a typescript library to print a given temperature in the console in 7 segment style.

image

installation

the library can be installed via the npm package manager:

npm install @jibed/segmentdisplay

usage

With this you can print the temperature or a binary code in 7-segment style. when you want to print the temperature: you can write the temperature in the method:

supported chars:

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • °
  • C
  • ,
  • (space)

you can also give an optional parameter: how many times you want the text to be bigger (default == 1). if you want a frame around the printed text (default == false).

example input

import TempPrint;

console.log(TempPrint.printTemp("20,5°C"));
console.log(TempPrint.printTemp("20,5°C", true));
console.log(TempPrint.printTemp("20,5°C", true, 1));

output

 _  _        _  _  _
 _|| |      |_ |_||
|_ |_| |     _|   |_

 ___________________________
|    _  _        _  _  _    |
|    _|| |      |_ |_||     |
|   |_ |_| |     _|   |_    |
|___________________________|

 ________________________________________________________
|                                                        |
|                                                        |
|                                                        |
|                                                        |
|        _____  _____         _____  _____  _____        |
|             ||     |       |      |     ||             |
|             ||     |       |      |     ||             |
|             ||     |       |      |     ||             |
|             ||     |       |      |     ||             |
|        _____||     |       |_____ |_____||             |
|       |      |     |     |       |       |             |
|       |      |     |     |       |       |             |
|       |      |     |     |       |       |             |
|       |      |     |     |       |       |             |
|       |_____ |_____|     |  _____|       |_____        |
|                                                        |
|                                                        |
|                                                        |
|                                                        |
|________________________________________________________|

it is also possible to enter binary code. you can enter a 8 bit binary code:

how to

image

if you want to use binary code you need to set a b befor yout input and between every binary a '/'.

in the photo above you see the letters displayed: ABCDEFGH

if you want a line on the place of the letter, you need to write a 1 on the place of the letter. f.e.: 3 is 10110110 and 0 = 11011110 so for example the input for "30 °C" would be: b/10110110/11011110/00000000/11110000/11001100

example input1

import TempPrint;

console.log(TempPrint.printTempb("b/10110110/11011110/00000000/11110000/11001100"));
console.log(TempPrint.printTemp("b/10110110/11011110/00000000/11110000/11001100", true));

output1

 _  _     _  _
 _|| |   |_||
 _||_|      |_
 _____________________
|    _  _     _  _    |
|    _|| |   |_||     |
|    _||_|      |_    |
|_____________________|

others

when you use binary code, you can also use the supported characters inbetween them.

example input2

import TempPrint;

console.log(TempPrint.printTempb("b/3/11011110/ /°/11001100"));
console.log(TempPrint.printTemp("b/10110110/0/00000000/11110000/C", true));

output2

 _  _     _  _
 _|| |   |_||
 _||_|      |_
 _____________________
|    _  _     _  _    |
|    _|| |   |_||     |
|    _||_|      |_    |
|_____________________|

contributing

its not necessary to document your changes but I highly recommend it. For major changes, I'd prefer you discuss it with me

name: Jibe Defoor email: jibe.defoor@hotmail.com

license

MIT

documentation

documentation

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago