User Tools

Site Tools


the_software_build_and_test

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
the_software_build_and_test [2017/01/22 19:47] walkeradminthe_software_build_and_test [2023/03/09 22:35] (current) – external edit 127.0.0.1
Line 20: Line 20:
   - My 7 Segment LED has a time separator and full stops (so is 8 segments) the original does not.   - My 7 Segment LED has a time separator and full stops (so is 8 segments) the original does not.
   - I used different GPIO lines.   - I used different GPIO lines.
-\\  
-\\  
  
 ---- ----
- +==== Working Clock Code ==== 
-This is the final version of code that was used. It has the support for the flashing dots time separator. If cutting and pasting isn't working well for you, download the python file {{ :working_new.zip |here:}} +\\  
-<file>+This is the final version of code that was used. It has the support for the flashing dots time separator. If cutting and pasting isn't working well for you, download the python file {{ :7segmentledclock_v1.0.zip |Here}}. 
 +<sxh [py][; options for SyntaxHighlighter]>
 #! /usr/bin/python #! /usr/bin/python
-code modified, tweaked and tailored from code by bertwert  +Python Script to run a 7 Segment Common Anode LED as a clock.  
-on RPi forum thread topic 91796+Version 1.0
 import RPi.GPIO as GPIO import RPi.GPIO as GPIO
 import time import time
Line 73: Line 72:
 try: try:
     while True:     while True:
-        = time.ctime()[11:13]+time.ctime()[14:16] +        time_string str(time.ctime()[11:13]+time.ctime()[14:16]).rjust(4)
-        s = str(n).rjust(4) +
         for digit in range(4):         for digit in range(4):
 +#select digit to display
             GPIO.output(gpioDigits[digit], 1)             GPIO.output(gpioDigits[digit], 1)
-            for segment in range(0,8):          +#set required segments on          
-                GPIO.output(gpioSegments[segment], numbers[s[digit]][segment]) +            for segment in range(0,8): 
 +                GPIO.output(gpioSegments[segment], numbers[time_string[digit]][segment])  
 +#check to see if we are on segment 3 of digit 2(LTR)
                 if ((digit==1) and (segment==2)):                 if ((digit==1) and (segment==2)):
- if (colon_counter<=25):+#when colon counter gets to set value flip colon display mode between TRUE (visible) and False (NOT.visible) 
 + if (colon_counter<=50): 
 +#count value not reached turn colon ON or OFF based on current setting of colon_visible
  if colon_visible==True:  if colon_visible==True:
  GPIO.output(13, 0)  GPIO.output(13, 0)
  else:  else:
  GPIO.output(13, 1)  GPIO.output(13, 1)
 +#colon counter set value reached so flip colon display mode and reset colon counter
  else:  else:
  colon_counter = 0  colon_counter = 0
  colon_visible =  not colon_visible  colon_visible =  not colon_visible
 +#display all selected segments for a short time
             time.sleep(0.005)             time.sleep(0.005)
-             +#turn-off All segments 
-            for segment in (gpioSegments): +            for segment in range(0,8): 
-                GPIO.output(segment,GPIO.HIGH) +                GPIO.output(gpioSegments[segment],GPIO.HIGH) 
-                 +#turn-off current digit selector pin 
-            for digit in (gpioDigits): +            GPIO.output(gpioDigits[digit], GPIO.LOW) 
-                GPIO.output(digit,GPIO.LOW) +#advance colon counter
         colon_counter=colon_counter+1         colon_counter=colon_counter+1
 finally: finally:
-  gpio.cleanup() +  GPIO.cleanup() 
-</file>+</sxh>
 \\  \\ 
 \\  \\ 
Line 107: Line 110:
 \\  \\ 
 ==== Here is the original code, unedited ==== ==== Here is the original code, unedited ====
-<file>+<sxh [py][; options for SyntaxHighlighter]>
 # code modified, tweaked and tailored from code by bertwert  # code modified, tweaked and tailored from code by bertwert 
 # on RPi forum thread topic 91796 # on RPi forum thread topic 91796
Line 158: Line 161:
 finally: finally:
     GPIO.cleanup()     GPIO.cleanup()
- +</sxh>
-</file>+
the_software_build_and_test.1485114454.txt.gz · Last modified: 2023/03/09 22:35 (external edit)