当前位置: 首页>>代码示例>>Python>>正文


Python Display.singleChar方法代码示例

本文整理汇总了Python中display.Display.singleChar方法的典型用法代码示例。如果您正苦于以下问题:Python Display.singleChar方法的具体用法?Python Display.singleChar怎么用?Python Display.singleChar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在display.Display的用法示例。


在下文中一共展示了Display.singleChar方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: NuimoTimer

# 需要导入模块: from display import Display [as 别名]
# 或者: from display.Display import singleChar [as 别名]
class NuimoTimer(Nuimo):
    def __init__(self, macAddress):
        Nuimo.__init__(self, macAddress)        
        self.display = Display()
        self.font = ValidFonts()
        self.timerValue = 0
            
    def fly(self, flyValue):
        print(flyValue)
        
    def swipe(self, swipeValue):
        print(swipeValue)
        # Left
        if swipeValue == 0:
            #self.timer.Start()
            self.displayLedMatrix(self.display.singleChar("2", "clb8x8"), 1.0)
            
        # Right
        elif swipeValue == 1:            
            self.displayLedMatrix(self.display.singleChar("1", "clb8x8"), 1.0)
        # Up
        elif swipeValue == 2:
            self.displayLedMatrix(self.display.icon("start"), 1.0)
        # Pause Timer
        elif swipeValue == 3:
            #self.timer.Pause()
            self.displayLedMatrix(self.display.icon("pause"), 1.0)
        else:
            pass
        
    def rotate(self, rotateValue):
        print(int(rotateValue))
        if rotateValue < 0:
            if self.timerValue <= 0:
                self.timerValue = 0               
            else:
                self.timerValue = self.timerValue-1                
        else:
            self.timerValue = self.timerValue + 1

        self.displayTimer()
                    
    
    def displayTimer(self):
        if self.timerValue <= 9:                
            self.displayLedMatrix(self.display.singleChar(str(self.timerValue),"clb8x8"),0.5)
        else:
            self.displayLedMatrix(self.display.icon(str(self.timerValue)),0.5)
             
                    
    def button(self, buttonValue):
        if buttonValue == 0:
            #self.selfTestFont()
            self.displayLedMatrix(self.display.icon("88"), 1.0)

    def selfTestFont(self):        
        chars = ["99","88","1","2","3","4","5","6","7","8","9","0","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
        for x in range(0, len(chars)):
            self.displayLedMatrix(self.display.singleChar(chars[x], "clb8x8"), 0.5)
            print(chars[x])
            time.sleep(0.75)
            

    def getNuimoBatteryLevel(self):
        pass
开发者ID:RezaMahmood,项目名称:nuimo-timer,代码行数:67,代码来源:nuimo-timer.py


注:本文中的display.Display.singleChar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。