GithubHelp home page GithubHelp logo

aashish24 / raspberry-gpio-emulator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nosix/raspberry-gpio-emulator

0.0 3.0 0.0 62 KB

RPi.GPIO emulator

License: Apache License 2.0

Python 100.00%

raspberry-gpio-emulator's Introduction

raspberry-gpio-emulator

RPi.GPIO emulator (tested by macOS 10.12)

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
  • setwarnings(flag)
    • flag : bool
  • 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
  • output(channel, outmode)
    • channel : int or Sequence[int]
    • outmode : GPIO.LOW, GPIO.HIGH or Sequence[GPIO.LOW or GPIO.HIGH]
  • input(channel) : bool
    • channel : int
  • cleanup(channel)
    • channel (option) : int or Sequence[int]
  • wait_for_edge(channel, event, timeout) : int or None
    • channel : int
    • event : GPIO.RISING, GPIO.FALLING or GPIO.BOTH
    • timeout (option) : int [millisecond]
  • 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 [millisecond]
  • add_event_callback(channel, callback, bouncetime)
    • channel : int
    • callback : function(channel)
      • channel : int
    • bouncetime (option) : int [millisecond]
  • remove_event_detect(channel)
    • channel : int
  • event_detected(channel) : bool
    • channel : int
  • gpio_function(channel) : GPIO.OUT, GPIO.IN, GPIO.SERIAL, GPIO.SPI, GPIO.I2C or GPIO.HARD_PWM
    • channel : int
  • PWM(channel, frequency) : GPIO.PWM
    • channel : int
    • frequency : float [Hz]

GPIO.PWM:

  • start(duty_cycle)
    • duty_cycle : float [0.0..100.0]
  • stop()
  • ChangeFrequency(frequency)
    • frequency : float [Hz]
  • ChangeDutyCycle(duty_cycle)
    • duty_cycle : float [0.0..100.0]

Usage

Documentation of raspberry-gpio-python:

Sample code:

Custom UI

You can use custom user interface which you wrote. --ui option enable custom user interface. --ui option require user interface module which has create_ui() function.

$ python sample_custom_ui_launcher.py --ui sample_custom_ui

Sample code:

Plugin

You can use plugins which you wrote. List plugin modules which have create_plugin() function. Plugin observe change event.

$ python sample_plugin.py sample_plugin_a sample_plugin_b

Sample code:

Credit

This project based on Pi GPIO Emulator.

raspberry-gpio-emulator's People

Contributors

nosix avatar

Watchers

Aashish Chaudhary avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.