Git Product home page Git Product logo

stepper's Introduction

Arduino Stepper

Stepper code for arduino.

I was unable to use the original stepper lib from Stepper which just did not work for me. The flow seemed to be wrong for my wirering so i wrote something myself from scratch.

Finally i put it into a class which now is able to drive steppers in a generic manner. Even the flow is declared at construction.

This code is more generic than the official code as you can have as many pins as you like and any kind of flow to control these pins.

you define the pins like:

	const static unsigned int Pins[] = {8, 9, 10, 11, };

which you can given to the constructor with a given macro:

	COUNTED_PARAMETER(Pins)

(to make sure the object knows how many pins you defined) and the flow can be defined by something like:

	const static unsigned int States[] = {
		0b0001,
		0b0010,
		0b0100,
		0b1000,
		};

(nicely readable as gnu c++ supports binary numbers) with the same macro COUNTED_PARAMETER to ensure the right size. Maximum for pins is 5 and states is 10 (which can easlily be changes - you've got the source). Finally you construct your stepper object like this:

	Stepper stepper = Stepper(500, 1000, COUNTED_PARAMETER(Pins), COUNTED_PARAMETER(States));

and use stepper.step(100) as always. Currently the code is just a complete Arduino program, all functions are inline.

stepper's People

Watchers

James Cloos avatar M. Dietrich 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.