LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Using LIFA with Arduino Motor Shield

I'm having a problem controlling a stepper motor using an Arduino UNO rev3 and the official Arduino Motor Shield. When I open the stepper motor example, there are choices for which driver to use, easydriver, Adafruit, etc. Maybe this VI was written before Arduino made their own motor sheild? Anyway, the lights on the motor shield blink only on the A+A- ports and the B+B- maybe have the brakes on? And what results is the motor just vibrates. In the vi, its written to use pins 2,3 which I dont understand.

I did manage to control the motor with low level commands setting pins high and low for the coils and brakes alternating. But it would be nice I could get the example working. Maybe Adafruit motor shield is the same thing? or similiar to where I could just change pin numbers?

0 Kudos
Message 1 of 7
(5,902 Views)

LIFA uses the Arduino Stepper Motor API, do you know of your shiled works with this API?  That the first thing that I would check, write an Arduion program with that API (without LIFA) and make sure that that works first.  Let us know the results with details.

0 Kudos
Message 2 of 7
(3,668 Views)

Sorry, I'm not exactly sure what you mean but this works:

/*************************************************************
Motor Shield Stepper Demo
by Randy Sarafan

For more information see:
http://www.instructables.com/id/Arduino-Motor-Shield-Tutorial/

*************************************************************/

int delaylegnth = 30;

void setup() {
 
  //establish motor direction toggle pins
  pinMode(12, OUTPUT); //CH A -- HIGH = forwards and LOW = backwards???
  pinMode(13, OUTPUT); //CH B -- HIGH = forwards and LOW = backwards???
 
  //establish motor brake pins
  pinMode(9, OUTPUT); //brake (disable) CH A
  pinMode(8, OUTPUT); //brake (disable) CH B


 
 
}

void loop(){

  digitalWrite(9, LOW);  //ENABLE CH A
  digitalWrite(8, HIGH); //DISABLE CH B

  digitalWrite(12, HIGH);   //Sets direction of CH A
  analogWrite(3, 255);   //Moves CH A
 
  delay(delaylegnth);
 
  digitalWrite(9, HIGH);  //DISABLE CH A
  digitalWrite(8, LOW); //ENABLE CH B

  digitalWrite(13, LOW);   //Sets direction of CH B
  analogWrite(11, 255);   //Moves CH B
 
  delay(delaylegnth);
 
  digitalWrite(9, LOW);  //ENABLE CH A
  digitalWrite(8, HIGH); //DISABLE CH B

  digitalWrite(12, LOW);   //Sets direction of CH A
  analogWrite(3, 255);   //Moves CH A
 
  delay(delaylegnth);
   
  digitalWrite(9, HIGH);  //DISABLE CH A
  digitalWrite(8, LOW); //ENABLE CH B

  digitalWrite(13, HIGH);   //Sets direction of CH B
  analogWrite(11, 255);   //Moves CH B
 
  delay(delaylegnth);

}

0 Kudos
Message 3 of 7
(3,668 Views)

Well, yeah that works because it was written specifically for that board.  I'm asking if the Arduino Stepper Motor API (look at the include files that come with LIFA) works with the shield.

0 Kudos
Message 4 of 7
(3,668 Views)

No they do not. I tried stepper_one_revolution and it was using pins 8,9,10,11. It vibrated and only lit up the B channel on the shield. I changed the pin numbers to 3,11,12,13 and all channel lights flickered, but still just vibrating.

SO its safe to say that LIFA will not work with this shield? Thats fine, like I said, I can still use the low-level commands.

0 Kudos
Message 5 of 7
(3,668 Views)

Hi,

I'm having a similar problem to you and just wanted to ask how you go about editing low level commands. I dont have that much experience with LabVIEW unfortunately, so any help on this matter would be appreciated!

I'm using the same example VI as a starting point.

Thanks in advance!

0 Kudos
Message 6 of 7
(3,668 Views)

There is an example for the Arduino Motor Shield in Documents.  The title of the example is Arduino Motor Shield Demo.

hrh1818

0 Kudos
Message 7 of 7
(3,668 Views)