def lcd_write_str(value): #print "Write string: " #print value grove_rgb_lcd.setRGB(0, 255, 0) time.sleep(.5) #rove_rgb_lcd.setText(value) return 0
def lcd_write_str(value): #print "Write string: " #print value retry = 3 while retry > 0: try: grove_rgb_lcd.setRGB(0, 255, 0) grove_rgb_lcd.setText(value) time.sleep(.01) break except: print 'can not write lcd, retry again' retry = retry - 1 time.sleep(.1) if retry == 0: return -1 else: return 0