def show(self, num1, num2, num3, num4, isColon): grovepi.fourDigit_segment(display, 0, convert(num1)) grovepi.fourDigit_segment(display, 2, convert(num3)) if isColon == 1: grovepi.fourDigit_segment(display, 1, convert(num2) + 128) else: grovepi.fourDigit_segment(display, 1, convert(num2)) grovepi.fourDigit_segment(display, 3, convert(num4))
def change_time(number): print("Sending message") grovepi.fourDigit_segment(SENSOR_ID, 0, 0x9) # 15 = F grovepi.fourDigit_segment(SENSOR_ID, 1, 63) # 15 = F grovepi.fourDigit_segment(SENSOR_ID, 2, 63) # 15 = F grovepi.fourDigit_segment(SENSOR_ID, 3, 56) # 15 = F print("Sleeping for 2 seconds") time.sleep(2) print("Sending message") grovepi.fourDigit_number(SENSOR_ID, int(number), LEADING_ZERO) return "I changed the display! {}".format(number)
grovepi.fourDigit_number(display,56,leading_zero) time.sleep(.5) grovepi.fourDigit_number(display,567,leading_zero) time.sleep(.5) grovepi.fourDigit_number(display,5678,leading_zero) time.sleep(.5) print ("Test 5) Set individual digit") grovepi.fourDigit_digit(display,0,2) grovepi.fourDigit_digit(display,1,6) grovepi.fourDigit_digit(display,2,9) grovepi.fourDigit_digit(display,3,15) # 15 = F time.sleep(.5) print ("Test 6) Set individual segment") grovepi.fourDigit_segment(display,0,118) # 118 = H grovepi.fourDigit_segment(display,1,121) # 121 = E grovepi.fourDigit_segment(display,2,118) # 118 = H grovepi.fourDigit_segment(display,3,121) # 121 = E time.sleep(.5) grovepi.fourDigit_segment(display,0,57) # 57 = C grovepi.fourDigit_segment(display,1,63) # 63 = O grovepi.fourDigit_segment(display,2,63) # 63 = O grovepi.fourDigit_segment(display,3,56) # 56 = L time.sleep(.5) print ("Test 7) Set score") grovepi.fourDigit_score(display,0,0) time.sleep(.2) grovepi.fourDigit_score(display,1,0)
def off(self): grovepi.fourDigit_segment(display, 0, 0) grovepi.fourDigit_segment(display, 1, 0) grovepi.fourDigit_segment(display, 2, 0) grovepi.fourDigit_segment(display, 3, 0)
def setSegment(self, digit, value): print("set digit ", digit, " segment value to", value) grovepi.fourDigit_segment(self.port, digit, value) return