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


Python wiringpi.pinMode方法代码示例

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


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

示例1: raw_command

# 需要导入模块: import wiringpi [as 别名]
# 或者: from wiringpi import pinMode [as 别名]
def raw_command(self, command):
        if command == 0:
            stop()
            return

        if not self.engauged:
            wiringpi.pinMode(1, wiringpi.GPIO.PWM_OUTPUT)
            wiringpi.pwmSetMode( wiringpi.GPIO.PWM_MODE_MS )

            # fix this to make it higher resolution!!!
            wiringpi.pwmSetRange( 1000 )
            wiringpi.pwmSetClock( 400 )
            self.engauged = True
            
        clockcmd = 60 + 30*command
        clockcmd = int(min(110, max(36, clockcmd)))
        wiringpi.pwmWrite(1, clockcmd) 
开发者ID:pypilot,项目名称:pypilot,代码行数:19,代码来源:servo.py

示例2: __init__

# 需要导入模块: import wiringpi [as 别名]
# 或者: from wiringpi import pinMode [as 别名]
def __init__(self, gpio_pin_a, gpio_pin_b, minimum_delay = 0.5):
        volumio_buddy_setup()
        self._callback_function = False
        self._callback_args = False
        self.in_critical_section = False
        self.direction = RotaryEncoder.UNKNOWN
        self.prev_direction = RotaryEncoder.UNKNOWN
        self.prev_state = 0
        self.last_push = 0
        self.minimum_delay = minimum_delay
        self.gpio_pin_a = gpio_pin_a
        self.gpio_pin_b = gpio_pin_b
        wiringpi.pinMode(gpio_pin_a, wiringpi.GPIO.INPUT)
        wiringpi.pinMode(gpio_pin_b, wiringpi.GPIO.INPUT)
        wiringpi.pullUpDnControl(gpio_pin_a, wiringpi.GPIO.PUD_OFF)
        wiringpi.pullUpDnControl(gpio_pin_b, wiringpi.GPIO.PUD_OFF) 
开发者ID:foxey,项目名称:volumio-buddy,代码行数:18,代码来源:volumio_buddy.py

示例3: init

# 需要导入模块: import wiringpi [as 别名]
# 或者: from wiringpi import pinMode [as 别名]
def init():
	print(lirc_device)
	wiringpi.wiringPiSetup()
	wiringpi.pinMode(A_1_PIN,INPUT)
	wiringpi.pullUpDnControl(A_1_PIN,PUD_UP)
	wiringpi.pinMode(B_1_PIN,INPUT)
	wiringpi.pullUpDnControl(B_1_PIN,PUD_UP)
	wiringpi.pinMode(BTN_1_PIN,INPUT)
	wiringpi.pullUpDnControl(BTN_1_PIN,PUD_UP)

	wiringpi.pinMode(A_2_PIN,INPUT)
	wiringpi.pullUpDnControl(A_2_PIN,PUD_UP)
	wiringpi.pinMode(B_2_PIN,INPUT)
	wiringpi.pullUpDnControl(B_2_PIN,PUD_UP)
	wiringpi.pinMode(BTN_2_PIN,INPUT)
	wiringpi.pullUpDnControl(BTN_2_PIN,PUD_UP)

	wiringpi.pinMode(POWER_PIN,INPUT)
	wiringpi.pullUpDnControl(POWER_PIN,PUD_UP)

	thread.start_new_thread(encoder_loop, ())
	thread.start_new_thread(keypressd, (lirc_device, )) 
开发者ID:thk4711,项目名称:orangepi-radio,代码行数:24,代码来源:input_rot_only.py

示例4: __init__

# 需要导入模块: import wiringpi [as 别名]
# 或者: from wiringpi import pinMode [as 别名]
def __init__(self, logger, d = 20, motor_setup = 0, motor_driver = 1,\
               pid = 1, reset = 1, r = 10):
    self.logger = logger
    GPIO.setmode(GPIO.BCM)
    self.GPIO = GPIO
    self.motor_controller = motor_setup
    self.motor_driver = motor_driver
    if motor_driver == gpio:
      self.driver = motor_drivers.ada_motor_driver(GPIO, logger)
    elif motor_driver == i2c:
      self.driver = motor_drivers.i2c_motor_driver(logger)
    if motor_setup == mecanum:
      self.controller = motor_controllers.mecanum(logger)
      if motor_driver == i2c:
        self.driver.init_module(pid,reset,4)
    elif motor_setup == differential:
      self.controller = motor_controllers.differential(d)
      if motor_driver == i2c:
        self.driver.init_module(pid,reset,2)

    #TODO: write motor_setup == omni
    #TODO: fix wiringpi
    #    wiringpi.wiringPiSetup()
    #    wiringpi.pinMode(1, 2) 
开发者ID:HisarCS,项目名称:cuneyt,代码行数:26,代码来源:motor_controller.py

示例5: initOS

# 需要导入模块: import wiringpi [as 别名]
# 或者: from wiringpi import pinMode [as 别名]
def initOS():
	os.environ['SDL_FBDEV'] = '/dev/fb1'
	os.environ['SDL_MOUSEDEV'] = '/dev/input/touchscreen'
	os.environ['SDL_MOUSEDRV'] = 'TSLIB'
	os.environ['SDL_VIDEODRIVER'] = 'fbcon'

	try:
		# if this system has the newer screen control then turn off the SMTPE control so PWM works
		with open('/sys/class/backlight/soc:backlight/brightness', 'w') as f:
			f.write('0')
	except:
		pass


	wiringpi.wiringPiSetupGpio()
	wiringpi.pinMode(18, 2)
	wiringpi.pwmSetMode(wiringpi.PWM_MODE_MS)  # default balanced mode makes screen dark at about 853/1024
	wiringpi.pwmWrite(18, 1024) 
开发者ID:kevinkahn,项目名称:softconsole,代码行数:20,代码来源:hw.py

示例6: stop

# 需要导入模块: import wiringpi [as 别名]
# 或者: from wiringpi import pinMode [as 别名]
def stop():
        wiringpi.pinMode(1, wiringpi.GPIO.PWM_INPUT)
        self.engauged = False 
开发者ID:pypilot,项目名称:pypilot,代码行数:5,代码来源:servo.py

示例7: pwr_on

# 需要导入模块: import wiringpi [as 别名]
# 或者: from wiringpi import pinMode [as 别名]
def pwr_on():
 # Utiliser la numerotation GPIO
 wiringpi.wiringPiSetupGpio()
 # Mettre le GPIO en mode sortie = 1
 wiringpi.pinMode(POWER_KEY_GPIO,1)

 # Envoyer une impulsion au SIM800C
 wiringpi.digitalWrite(POWER_KEY_GPIO,1)
 time.sleep(1)
 wiringpi.digitalWrite(POWER_KEY_GPIO,0)

 # Avertir l'utilisateur
 s = "The SIM800C has booted"
 print s
 return; 
开发者ID:garatronic,项目名称:nadhat,代码行数:17,代码来源:nadhat_pwr_on.py

示例8: _pinmode

# 需要导入模块: import wiringpi [as 别名]
# 或者: from wiringpi import pinMode [as 别名]
def _pinmode(pin, mode):
    if pin not in _pinmodes or _pinmodes[pin] != mode:
        wiringpi.pinMode(pin, mode)
        _pinmodes[pin] = mode 
开发者ID:liffiton,项目名称:ATLeS,代码行数:6,代码来源:wiring.py

示例9: setup_pwm_pin_18

# 需要导入模块: import wiringpi [as 别名]
# 或者: from wiringpi import pinMode [as 别名]
def setup_pwm_pin_18(initial_value: float = 0):
    """
    Sets up pin 18 PWM.

    This method is required because the order of the calls to the methods required to setup a pwm pin through
    wiringpi matters and is mystical!

    Be warned -- This method will only allow you to setup pin 18 in a hardcoded way! You can however read the
    configuration variables used by looking at the pwm_pin attribute of this module.

    Args:
        initial_value (float): a value to set after setting up the pin for pwm
    """
    global pwm_pin
    if pwm_pin is not None:
        warnings.warn('Cannot set up pwm pin more than once! Skipping setup...')
        return

    pwm_pin = PWMPinInfo(pin_number=18, pwm_range=500, pwm_clock_divisor=765)
    wiringpi.pinMode(pwm_pin.pin_number, wiringpi.PWM_OUTPUT)  # Set SERVO pin as PWM output
    wiringpi.pwmWrite(pwm_pin.pin_number, 0)  # Turn output off

    # TODO: Ask Luke to explain these three pwm setup functions...
    wiringpi.pwmSetMode(wiringpi.PWM_MODE_MS)  # Set PWM mode as mark space (as opposed to balanced - the default)
    wiringpi.pwmSetRange(pwm_pin.pwm_range)  # Set PWM range (range of duty cycles)
    wiringpi.pwmSetClock(pwm_pin.pwm_clock_divisor)  # Set PWM clock divisor
    # Note: PWM Frequency = 19.2MHz / (pwm_divisor * pwm_range)

    wiringpi.pwmWrite(pwm_pin.pin_number, initial_value) 
开发者ID:JackBuck,项目名称:Robo-Plot,代码行数:31,代码来源:wiringpi_wrapper.py


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