Stepper motor problem


hi
i trying use stepper motor actuate blind lightwaverf home automation protocol. 4 wire 42byghw609 , is  on l293 based motor shield. works afmotor library example. when try integrate lightwaverf sketch turn once. suspect interrupts don't know begin looking.
here code:
code: [select]
#include <lwrx.h>
#include <eeprom.h>
#include <string.h>
#define echo true
#include <afmotor.h>
af_stepper motor(200, 1);
//lwrf code
static byte sideopen[10] = {1,15,0,1,3,2,10,14,9,7};
static byte sideclose[10] = {4,0,0,0,3,2,10,14,9,7};
int matchcounter = 0;

//msg data
byte msg[10];
byte msglen = 10;

void setup() {
  lwrx_setup(2);
serial.begin(9600);
serial.println(f("set ok"));
motor.setspeed(100);  // in rpm   
}
void loop() { 
  if (lwrx_message()) {
    lwrx_getmessage(msg, msglen);   
   if (comparemessage(msg, sideopen) == 10)
    {
     blindup();     
    }
     if (comparemessage(msg, sideclose) == 10)
    {
      blinddown(); 
    }   
  }
}
//compare incoming messages known codes
int comparemessage (byte * msg, byte * lwrfcommand)
{
  matchcounter = 0;
  (int = 0; < 10; i++)
  {
    if (msg[i] == lwrfcommand[i])
    {
      matchcounter++;
    }
  }
  return matchcounter;
}
void blindup()
{
     motor.step(200, forward, double);
}
void blinddown()
{
  motor.step(200, backward, double);
}

any ideas?



Arduino Forum > Topics > Home Automation and Networked Objects > Stepper motor problem


arduino

Comments

Popular posts from this blog

Authentication error while password reset - Raspberry Pi Forums

opencv3, tbb and rasp pi 2 - Raspberry Pi Forums

small ethernet problem - Raspberry Pi Forums