![]() These three strings are joined together with newlines on line 84 so that the function returns a single multiline string suitable to pass to print().ġ. Lines 27 to 75 have a long list of if- elif statements for each digit (and the decimal point and minus sign) that concatenates the rows of each digit to these strings. ![]() The strings represent the top, middle, and bottom row of the numeric digits. The getSevSegStr() function first creates a list of three strings. ![]() Will print 42, zero-padded to three digits: The output will look like this: This module is meant to be imported rather than run. The Program in ActionĮven though it’s a module, sevseg.py outputs a sample demo of the digits it produces when you run the program directly. You can find more information about seven-segment displays and other variations at. Project 14, “Countdown,” and Project 19, “Digital Clock,” import the sevseg.py file so they can use its getSevSegStr() function. The benefit of this program is that other programs can import it as a module. ![]() Through different combinations of seven line-shaped segments in an LCD, a seven-segment display can represent the digits 0 through 9. A seven-segment display is a type of LCD component used to display numbers in pocket calculators, microwave ovens, and other small electronic devices. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |