examenopdracht-tomvanhove
v2.0.1
Published
This project is under the MIT license, you can read it here: [LICENSE.md](LICENSE.md)
Downloads
24
Readme
Temperature 7 - segment LCD Display
Description
in this project, you can provide a temperature and choose if you want a border or not, in an 7 segment display style. I will show you how it works. Like it is very easy. In app.ts I made some examples.
const temperature = new Temperature()
temperature.setTemperature("100 °C", "small", false);
temperature.setTemperature("123 °C", "small", true);
temperature.setTemperature("-12756.69 °C", "small", true);
temperature.setTemperature("-12.69 °C", "small", true);
temperature.setTemperature("12345.6789°C", "big", false);
temperature.setTemperature("-1234567890. °C", "big", true);
temperature.setTemperature("126.69 °C", "big", true);
Basically you need to give 3 arguments with the setTemperature method of the Temperature class.
setTemperature(<temperature>: string, <size>: string, <border or not>: boolean)
as you can see, the first argument is the temperature, here in a string format, because the °C is not a number. So this was the easiest way to do it. the second argument is the option to have the temperature in a big or small format. the third argument is the option if you want a border or not.
the command to run the project:
ts-node index.ts
The result of the the statements above is:
_ _ _ _
|| || | |_||
||_||_| |_
__________________
| _ _ _ _ |
| | _| _| |_|| |
| ||_ _| |_ |
|__________________|
____________________________________
| _ _ _ _ _ _ _ _ |
| _ | _| ||_ |_ |_ |_| |_|| |
| ||_ | _||_| / |_| _| |_ |
|____________________________________|
___________________________
| _ _ _ _ _ |
| _ | _| |_ |_| |_|| |
| ||_ / |_| _| |_ |
|___________________________|
__ __ __ __ __ __ __ __ __
| | || || | || || || ||
| __| __||__||__ |__ ||__||__||__||
|| | | | | | || | | |
||__ __| | __| / |__| ||__| __| |__
____________________________________________________________
| __ __ __ __ __ __ __ __ __ __ |
| | | || || | || || || | | || |
| __ | __| __||__||__ |__ ||__||__|| | |__|| |
| || | | || | || | || | | |
| ||__ __| | __||__| ||__| __||__| / |__ |
|____________________________________________________________|
____________________________________
| __ __ __ __ __ __ |
| | || | | | | || |
| | __||__ |__ |__| |__|| |
| || | | | | | | |
| ||__ |__| / |__| __| |__ |
|____________________________________|
Like you can see, there are different types of visualization. You can choose them by providing it in de constructor above.
Unit tests
I've provide some unit test to see if the functionality is correct.
You can easily check them with following command
npm run test
this is the result
PASS tests/digits.test.ts
Test Suites: 2 passed, 2 total
Tests: 34 passed, 34 total
Snapshots: 0 total
Time: 1.674 s, estimated 4 s
Because of working with test, the index.ts file can be deleted. The test renders the index.ts file. The tests will check if your program works fine, so you don't need to manually check if the output is correct. I let the index file where it was. Because it is a bit easier to see the results in the terminal. But if you don't want to, you're free to delete.
NPM package
npm init --scope@my-org
npm publish --access public
License
This project is under the MIT license, you can read it here: LICENSE.md
Documentation
Via following link you can find the full documentation of the library: DOCUMENTATION OF THE LIBRARY
Author information
Name: Van Hove Tom
Email: [email protected]
Role: student
School: Vives University
Location: Bruges Belgium