Skip to content

Latest commit

 

History

History
78 lines (64 loc) · 2.51 KB

README.md

File metadata and controls

78 lines (64 loc) · 2.51 KB

raspberry-gpio-emulator

RPi.GPIO emulator

Require

  • Python 3.5

Install

$ pip install git+https://github.com/nosix/raspberry-gpio-emulator/

API

import RPi.GPIO as GPIO
  • GPIO.setmode(mode)
    • mode : GPIO.BOARD or GPIO.BCP
  • GPIO.setwarnings(flag)
    • flag : bool
  • GPIO.setup(channel, state, initial, pull_up_down)
    • channel : int or Sequence[int]
    • state : GPIO.OUT or GPIO.IN
    • initial (option) : GPIO.LOW or GPIO.HIGH
    • pull_up_down (option) : GPIO.PUD_OFF, GPIO.PUD_DOWN or GPIO.PUD_UP
  • GPIO.output(channel, outmode)
    • channel : int or Sequence[int]
    • outmode : GPIO.LOW, GPIO.HIGH or Sequence[GPIO.LOW or GPIO.HIGH]
  • GPIO.input(channel) : bool
    • channel : int
  • GPIO.cleanup(channel)
    • channel (option) : int or Sequence[int]
  • GPIO.wait_for_edge(channel, event, timeout) : int or None
    • channel : int
    • event : GPIO.RISING, GPIO.FALLING or GPIO.BOTH
    • timeout (option) : int
  • GPIO.add_event_detect(channel, event, callback, bouncetime)
    • channel : int
    • event : GPIO.RISING, GPIO.FALLING or GPIO.BOTH
    • callback (option) : function(channel)
      • channel : int
    • bouncetime (option) : int
  • GPIO.add_event_callback(channel, callback, bouncetime)
    • channel : int
    • callback : function(channel)
      • channel : int
    • bouncetime (option) : int
  • GPIO.remove_event_detect(channel)
    • channel : int
  • GPIO.event_detected(channel) : bool
    • channel : int
  • GPIO.gpio_function(channel) : GPIO.OUT, GPIO.IN, GPIO.SERIAL, GPIO.SPI, GPIO.I2C or GPIO.HARD_PWM
    • channel : int

Usage

Documentation of raspberry-gpio-python:

Sample code:

Credit

This project based on Pi GPIO Emulator.