1Department of Biotechnology, College of Life Sciences, Xinyang Normal University, Xinyang, China.Get the first 4 chars of the string.Pengpeng Zhang 1, Mingxuan Sheng 1, Chunyu Du 1, Zhe Chao 2, Haixia Xu 1, Xiaofang Cheng 1, Cencen Li 1* and Yongjie Xu 1,3*
#Make the cut 4.1.0 expression code#
"Char", the code for every char(you should not delete any thing of the values).įor(byte i = 0 i stringLength) char1 = ' ' įor(int t = 0 t stringLength) char1 = ' ' Use this function to print a character (any character in array "Char" in "array.h") on any digit.īyte seg ,//S/17 looks like number 5 When the length of "Phrase" is more than 4, "Delay" is custom speed for movement, for example: printDisplay("all usable characters ? ]]",300) When the length of "Phrase" is 4 or less than 4, "Delay" is the time for printing on display, for example: printDisplay("2021",1000) If the length of "Phrase" is more than 4, the Phrase will move from the start to the ending of it. The first entry of this function(String Phrase) is the string that you want to print. Use this function to print a string (has numbers, characters or phrases). Those functions are defined in file "functions.h".
#Make the cut 4.1.0 expression download#
Include files "array.h" "functions.h" ( download those files from code section of this project, Those files should be in the same folder along with the code ). The type of the display, set to your display's type. bool mode = common_anode // my display is common anode Main code explanation: #define common_cathode 0
PrintDigit('y',D1) //print any char on any digit PrintDisplay("all usable characters ? ]]",300) // when the length of string is more than 4, the second variable is custom speed for movement Reset() // use this function to reset the display PrintDisplay("2021",1000) // use this function to print a string (has numbers, characters or phrases) when the length of string is 4 or less than 4, the second variable is the time for printing on display the loop routine runs over and over again forever: initialize the digital pins as outputs.
In this project, we used this method to print any possible character on the display.īool mode = common_anode // my display is common anode Now set digit pin2 to LOW, and the other pins to HIGH, and set the 7 segment pins to Char 0.etc To display the number 2021 using Arduino, on a common cathode display: set digit 1 to LOW and the remaining digit pins to HIGH, now display Char 2. That requires all the 12 pins to be connected to Digital pins on Arduino.
This happens in a fast rate in order to make the eyes feels as if all four digits are active at the same time. Similarly, to display a set of characters on a 4 digit display, we active them in sequence and set the 7 segment pins to display the corresponding character.(i.e set the digit pin1 to the active state, set all the other digit pins to inactive state, and set the 7 segment pin to display character 1, then set digit pin2 only to active, and display charterer 2 and so on. To display a character on a 7-segment display you need to connect the common pin to the appropriate power pin (either GND or Vcc which activates it) and set the required segment pins to the opposite state ( i.e Vcc or GND). Similarly the 7-segment, 4-digit are either common cathode or common anode, hence we have four common pins for the 4 digits. The 7-segment is arranged in two ways: either all the cathodes of the segment are gathered in one pin (GND), and this type is called common cathode, or all the anodes are gathered in one pin (Vcc), and this type is called common anode. On the other hand, the 4 -digit display does not have 40 pins, rather it has only 12 pins: 7 segments, one dot, and 4 digit selection pins that select which digit will be active to display the character sent by the Arduino on the 7+1 segment pins. The 1 digit, 7-segment display has 10 pins, 7 for the segments, one for the dot, and 2 pins for the power supply (either GND or Vcc depending on the type of the display)