AFMotor shield and UNO WIFI REV2

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
st_hilton
 
Posts: 2
Joined: Thu Jan 13, 2022 9:24 am

AFMotor shield and UNO WIFI REV2

Post by st_hilton »

Hi
I have moved an adafruit motor shiled from an Uno to an uno wifi rev2, but get the compiler error:
compiles fine for an arduino uno.

Any help on this would be much appreciated.

C:\Users\stephen.hilton\Documents\Arduino\libraries\Adafruit_Motor_Shield_library/AFMotor.h:49:30: error: 'CS01' was not declared in this scope
#define MOTOR34_8KHZ _BV(CS01) // divide by 8
^
C:\Users\stephen.hilton\Documents\Arduino\libraries\Adafruit_Motor_Shield_library/AFMotor.h:52:33: note: in expansion of macro 'MOTOR34_8KHZ'
#define DC_MOTOR_PWM_RATE MOTOR34_8KHZ // PWM rate for DC motors
^~~~~~~~~~~~
C:\Users\stephen.hilton\Documents\Arduino\libraries\Adafruit_Motor_Shield_library/AFMotor.h:156:47: note: in expansion of macro 'DC_MOTOR_PWM_RATE'
AF_DCMotor(uint8_t motornum, uint8_t freq = DC_MOTOR_PWM_RATE);
^~~~~~~~~~~~~~~~~
C:\Users\stephen.hilton\Documents\Arduino\libraries\Adafruit_Motor_Shield_library/AFMotor.h:49:30: note: suggested alternative: 'B101'
#define MOTOR34_8KHZ _BV(CS01) // divide by 8
^
C:\Users\stephen.hilton\Documents\Arduino\libraries\Adafruit_Motor_Shield_library/AFMotor.h:52:33: note: in expansion of macro 'MOTOR34_8KHZ'
#define DC_MOTOR_PWM_RATE MOTOR34_8KHZ // PWM rate for DC motors
^~~~~~~~~~~~
C:\Users\stephen.hilton\Documents\Arduino\libraries\Adafruit_Motor_Shield_library/AFMotor.h:156:47: note: in expansion of macro 'DC_MOTOR_PWM_RATE'
AF_DCMotor(uint8_t motornum, uint8_t freq = DC_MOTOR_PWM_RATE);
^~~~~~~~~~~~~~~~~
exit status 1
Error compiling for board Arduino Uno WiFi Rev2.

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: AFMotor shield and UNO WIFI REV2

Post by adafruit_support_bill »

The original motor shield was discontinued a long time ago and the AFMotor library is no longer supported. AFMotor was written for the Atmega328 processors used in the Arduino Diecemila, Duimalanove and eventually the UNO. The UNO WiFi uses a completely different processor. And despite Arduino's claims of compatibility, it has numerous incompatibilities with the original UNO.

The errors you posted are related to setting the PWM frequencies used by the shield. This code is based on the Atmega328 timer registers. The processor used by the UNO WiFi has a different architecture and a different set of registers.

User avatar
st_hilton
 
Posts: 2
Joined: Thu Jan 13, 2022 9:24 am

Re: AFMotor shield and UNO WIFI REV2

Post by st_hilton »

thank you - is there a way to solve this?

I was thinking of I2C if easier - where a rev2 could connect to an UNO with shield?

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: AFMotor shield and UNO WIFI REV2

Post by adafruit_support_bill »

The Rev2 Motor shield uses I2C for all motor control and has its own built-in PWM generator. It should work with the UNO WiFi

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”