Giter Club home page Giter Club logo

micropython-stepper-motor-library's Introduction

micropython-stepper-motor-library

Een Micropython bibliotheek om een 28BYJ-48 5V stepper motor te kunnen gebruiken met ESP8266 of ESP32.

Installatie

  • Optie 1: gebruik python MPFshell om die lib te upload naar jouw Micropython apparaat
foo@bar:~$ pip3 install mpfshell
foo@bar:~$ git clone https://github.com/pappavis/micropython-stepper-motor-library
foo@bar:~$ cd micropython-stepper-motor-library
foo@bar:~$ mpfshell /dev/ttyUSB0
mpfs [/]> mkdir lib
mpfs [/]> cd lib
mpfs [/]> put uln2003_e4k.py
mpfs [/]> exit
foo@bar:~$
  • Optie 2: Upload middels Thonny IDE voor Micropython.

Gebruik

s1 = Stepper(mode, in1, in2, in3, in4, delay)

mode: MODE_ACHTERUIT|MODE_VOORUIT in1 tot in4: pinnen om te gebruiken delay: vertraging milliseconden.

Voorbeeld:

import machine
import micropython
import uln2003_e4k
import esp
esp.osdebug(None)
import gc
gc.collect()

def main():
    # easy Wemos D1 mini pin lookup.
    wemosPinsDict = {"D4":2, "D3":0, "D2":4, "D1":5, "RX":3, "TX":1, "D8":15, "D7":13, "D6":12, "D5":14, "D0":16}

    # run forward once for 1/8th revolution.
    s1 = Stepper(mode=MODE_ACHTERUIT,in1=wemosPinsDict["D1"], in2=wemosPinsDict["D2"], in3=wemosPinsDict["D3"], in4=wemosPinsDict["D4"], delay=0.01)
    runner.run([Command(stepper=s1, steps=FULL_ROTATION/8)])  # run forward


print("App start")
main()
print("App eind")

Meer weten?

Contact mij bij #Easylab4kids #e4k

micropython-stepper-motor-library's People

Contributors

pappavis avatar

Stargazers

 avatar

Watchers

 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.