7-segment display
Exam assignment 2020 - Software Engineering Matthias Willem
A TypeScript library that can display temperature data in the console in LCD style according to following format:
______________________
| _ _ _ _ |
| | _| _||_| |_|| |
| ||_ / _| | |_ |
|______________________|
Installation
Installing the package
This package package is available on npmjs.com. Check it out!
Just run this command:
npm i @matthiaswillem/7-segment_display
Building a package
If you want to create a package yourself
Programs
Node.js
Visual Studio Code ( Not really necessary but it is useful )
Command line
Install npm
npm install npm@latest -g
Install typescript
npm install -g typescript
Install ts-node
npm install -g ts-node
Documentation
The documentation of the package can you find at the GitHub Pages
Examples
Here I will give you some examples for using this package. The main method is:
display(temperature: number, frame: boolean)
In the first parameter temperature, you can give a number what the temperature should be.
In the second parameter frame, you can the method you want a frame (true
) or not (false
).
With border
An example command
display(12.34291, true)
The output
________________________
| _ _ _ _ |
| | _| _||_| |_|| |
| | |_ / _| | |_ |
|________________________|
Without border
An example Command
display(6, false)
The output
_ _ _ _ _
|_ | || | |_||
|_| / |_||_| |_
Versions
All NPM versions are the same of the github versions tags.
0.0.0
Project Setup
Added some files:
- README file
- LICENCE file
- Markdown Linter by commit
- ES Linter Checker by commit
- NPM Package
- Jest test file
- .gitIgnore file
Edited some files:
- README
- Added
- Badges
- NPM Version
- License
- ESLint Check
- Markdown Check
- Discription
- Installation
- Versions
- License
- Author information
- Badges
- Added
- display.ts
- Added
- Example
- Added
- display.test.ts
- Added
- Example
- Added
0.1.0
Project Start - Read the temperature
Edited some files:
- README
- Added
- New version (0.1.0)
- Added
- display.ts
- Removed
- Example
- Added
- setTemp()
- getTemp()
- getRoundedTemp()
- Removed
- display.test.ts
- Removed
- Example
- Added
- Some tests for testing all new methods
- Removed
0.1.1
Put temperature chars into array + read
Edited some files:
- README
- Added
- New version (0.1.1)
- Added
- display.ts
- Added
- getTempNumbArray()
- getTempArrayValue(index: number)
- tempToArray()
- Added
- display.test.ts
- Added
- Some tests for testing all new methods
- Added
0.1.2
Doesn't exist anymore. I removed it for a small bugfix and didn't noticed you can't ever publish the same version again after you removed one.
You can find more info here about it.
0.1.3
Array of the whole temperature
Edited some files:
- README
- Added
- Version problem 0.1.2
- New version (0.1.3)
- Added
- display.ts
- Added
- getTempArray()
- buildTempArray()
- Added
- display.test.ts
- Added
- Some tests for testing all new methods
- Added
0.1.4
Printing temperature array in one string
Edited some files:
- README
- Added
- New version (0.1.4)
- Added
- display.ts
- Added
- printDisplay()
- Added
- display.test.ts
- Added
- Some tests for testing all new methods
- Added
0.1.5
Reworked printDisplay method Cleaner, DRY code. Removed spaces between numbers
Edited some files:
- README
- Added
- New version (0.1.5)
- Added
- display.ts
- Modified
- printDisplay()
- Modified
0.1.6
Added everywhere default the °C symbol.
Edited some files:
- README
- Added
- new version (0.1.6)
- Added
- display.ts
- Modified
- buildTempArray()
- setTemp(value: number)
- Modified
- display.test.ts
- Modified
- All tests added the °C symbol
- Modified
0.2.0
The basics work (No Frame, no 2x Font)
Fully rebuild project:
- Separated much methods in some other methods for the Single Responsibility Principle (SRP)
- Changed much names of methods
- Had to change the tests too (And remove some)
- Added documentation
Edited some files:
- README
- Added
- Documentation (GitHub Pages)
- New minor version (0.2.0)
- Added
- docs
- Added docs directory for github pages
- display.ts
- Added
- setTempNumb(temperature: number)
- getTempNumb()
- tempNumbRound()
- temperatureAddCelcius()
- setTemperature(temperature: number)
- getTemperature()
- temperatureToArray()
- getTemperatureArray()µ
- checkAndBuildChar(tempArrChar: number, tempChar: number)
- buildDisplayArray()
- getDisplayArray()
- resetOutput()
- resetIndentation()
- printFirstRow()
- printSecondAndThirdRow()
- changeIndentation(row: number)
- printDisplay()
- Removed
- setTemp(value: number)
- getTemp()
- getRoundedTemp()
- getTempNumbArray()
- getTempArrayValue(index: number)
- tempToArray()
- getTempArray()
- printDisplay()
- buildTempArray()
- Added
- display.test.ts
- Modified
- All tests are modified with the correct names
- Modified
0.3.0
Added the frame to the project
Edited some files:
- README
- Added
- New minor version (0.3.0)
- Examples
- Added
- docs
- Added
- The new methods
- Added
- display.ts
- Added
- checkBorder(border: boolean)
- createHorBorderTop(border: boolean)
- createHorBorderBottom(border: boolean)
- display(temperature: number, frame: boolean)
- modified
- printDisplay(frame: boolean)
- changeIndentation(row: number)
- printFirstRow()
- resetOutput()
- one[] (for better layout)
- Added
- display.test.ts
- Added
- 2 new tests for printDisplay(true)
- 2 new tests for display(temperature: number, frame: boolean)
- Added
Licence
This project is licensed under the MIT License - see the LICENSE file for details
Author information
Matthias Willem
Student Electronics-ICT VIVES Bruges