This is a repository for printing Temperatures in LCD Display format.
Its developed in typescript and uses npm package manager to install.
The 7-Segment display is built with the segments A through G.
I used these with a boolean function to either show them on or off (true or false).
Example:
case 0 : {this.a=true; this.b=true; this.c=true; this.d=true; this.e=true; this.f=true; this.g=false; break}
This would return a 0 on the display.
These are the different values you can give to the DrawSegment
and DrawBigSegment
Classes.
case 0 : draws the number '0'
case 1 : draws the number '1'
case 2 : draws the number '2'
case 3 : draws the number '3'
case 4 : draws the number '4'
case 5 : draws the number '5'
case 6 : draws the number '6'
case 7 : draws the number '7'
case 8 : draws the number '8'
case 9 : draws the number '9'
case 10 : draws Degrees sign
case 11 : draws Celsius sign
case 12 : draws Minus sign
I got the idea to use a switch statement by finding the repository from SK-SpeedBit
This class draws the segments for the numbers depending on the number you enter into the constructor. It utilizes the cases above.
import DrawSegment from './DrawSegment'
const segment = new DrawSegment(0); // We give a 0 to the constructor to let it know we want a 0 printed
segment.print(); // Using the .print() function we tell the segment to print to the console.
This class is using the same functionality as the DrawSegment Class.
The Class also prints the number you request but with double the segments. Also uses the same switch case.
import DrawBigSegment from './DrawBigSegment'
const segment = new DrawBigSegment(0);
segment.print();
import DrawTemperature from './DrawTemperature'
const temperature = new DrawTemperature(8.2);
temperature.printToConsole();
temperature.return();
The temperature.printToConsole();
Prints the temperature to the console in your web-browser.
temperature.return();
Returns the temperature as a string so it can be used in other methods.
Same functionality of the DrawTemperature Class with the exception of the numbers being double size.
import DrawBigTemperature from 'DrawBigTemperature'
const bigTemperature = new DrawBigTemperature(-5.3);
bigtemperature.printToConsole(); // To print to console
bitemperature.return(); // To return as a string.
npm run test
Runs the coded tetst that have been programmed using Jest.
Jest is a JavaScript Testing Framework that also supports the tests for TypeScript.
MIT
Through TypeDoc we setup Github Pages. This is automatically generated documentation for your Typescript Project.
The link for the Github Pages
for this repository: Github Pages
Author: Michiel Decoster
Student at Vives Hogeschool Brugge
Generated using TypeDoc