Pages: [1]   Go Down
Author Topic: Motor Shield Programming Error  (Read 611 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello;
    I have some problems about adafruit motor shield programming.I'm sure that I installed library correctly however when I tried to upload a sketch in ladyada's site it shows an error;" 'CS20' was not declared on this scope.".Here is the code;                                                

Code:
#include <AFMotor.h>

AF_DCMotor motor(2, MOTOR12_64KHZ);

void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Motor test!");
  
  motor.setSpeed(200);     // set the speed to 200/255
}

void loop() {
  Serial.print("tick");
  
  motor.run(FORWARD);      // turn it on going forward
  delay(1000);

  Serial.print("tock");
  motor.run(BACKWARD);     // the other way
  delay(1000);
  
  Serial.print("tack");
  motor.run(RELEASE);      // stopped
  delay(1000);
}

Note: I'm using Arduino Leonardo and a clone motor shield.

Thanks For any help
« Last Edit: February 14, 2013, 03:48:14 pm by rduiohd » Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 212
Posts: 8940
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I suspect the Adafruit library is manipulating the timer hardware to get 64kHz PWM and has not been updated to work with the timer hardware of the Leonardo.  Look for an updated library or bypass the library and talk to the hardware directly.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

   Yes,I did try it on uno and it worked.Thanks for your reply
Logged

Pages: [1]   Go Up
Jump to: