Problem using stepmotors and bluetooth [solved]


#1

Hi,
Im having some problems using two (or one) step motors and bluetooth.

I wrote a function to contol two of them, it looks like this:

void moveTo(int x, int y)
{
  stepperX.moveTo(x);
  stepperY.moveTo(y);
  
  while(stepperX.currentPosition() != x || stepperY.currentPosition() != y)
  {
    if(stepperX.currentPosition() != x)
    {
      stepperX.run();
    }
    if(stepperY.currentPosition() != y)
    {
      stepperY.run();
    }
  }
}

It works perfectly, the problem is, after I make the call:

bluetooth.begin(9600);

edit:
I traced it one step further, its after Me_BaseShield::begin(); that it stops working.

the motors wont move. If I read the value from stepperX.currentPosition(), it seems to think its moving.

Anyone got an idea of what might be wrong?

Thanks
Johan


#2

Soved it, im not sure if this is a correct solution, or if bluetooth work.

But after bluetooth.begin(9600);

I added:

stepperX.enableOutputs();
stepperY.enableOutputs();

This will cause
pinMode(_pin[2], OUTPUT);
pinMode(_pin[3], OUTPUT);

to be rewritten, they were overwritten by Me_BaseShield::begin();

Will test some more when I get the time.


#3

Good to know you solved it by yourselves. Bravo!


#4

Yes, it seems to be working fine now.


#5