StepperUNO Library 1.1

From lechacal
Jump to navigation Jump to search

under construction...

Installation

Download the zip file.
Copy the StepperUNO folder in the sketchbook/library directory.


Configuration

Open the config.h file in the library/stepperUNO folder.
Change the KEYPAD_VERSION value as needed. Value should be 1 or 2. If you do not know just try one or the other and see how the button reacts.

Function list

Keypad

uint8_t ReadKey();

Return which key is currently pressed.

Keys are defined as below:

#define BUTTON_NONE               0  // 
#define BUTTON_RIGHT              1  // 
#define BUTTON_UP                 2  // 
#define BUTTON_DOWN               3  // 
#define BUTTON_LEFT               4  // 
#define BUTTON_SELECT             5  //

bool RstReadKey();

Return if the RST button is pressed or not.

The RST button is a special case. It has its own pin to the arduino mcu.

bool buttonJustPressed;

//this will be true after a ReadButtons() call if triggered

bool buttonJustReleased;

//this will be true after a ReadButtons() call if triggered

bool rstbuttonJustPressed;

//this will be true after a ReadButtons() call if triggered

bool rstbuttonJustReleased;

//this will be true after a ReadButtons() call if triggered

bool rstbuttonLongPress;

Motor Control

void speed(int speed_m1);

Set the motor speed.

speed_m1 must be the delay between each step in milliseconds.

void setDirection(bool dir);

void enable();

void disable();

Disable the motor. Allows the motor to spin freely.

void step();

Perform one single step.

void stop();

Stop the motor.

uint8_t address;

void begin(uint8_t _address);

bool running;

Indicate if the motor is running.

bool direction;

Indicate the motor direction.

State variables