Forum >DFRobot Romeo V2 PWM pin 9, and 10 not working
RoboticsGeneral

DFRobot Romeo V2 PWM pin 9, and 10 not working

userHead pratyadi 2013-04-12 18:08:19 8224 Views7 Replies
I tried the PWM pins that were specified in the product description [url=http://www.dfrobot.com/index.php?route=product/product&filter_name=romeo&product_id=844]http://www.dfrobot.com/index.php?route=product/product&filter_name=romeo&product_id=844[/url]:
•PWM: 3, 5, 6, 9, 10, 11, and 13. Provide 8-bit PWM output

I tried the LED dimmer codes on all of the above, yet 9 and 10 dont work :-\

Is there a code fix for this? ??? Perhaps the C library in the Arduino IDE somewhere?
2013-07-04 19:33:52 Hi All,

After a long experiments I finally found a way to drive a PWM servo without relying on any PWM pin. This tutorial will show you how to position the servo angle by writting your own PWM function on Arduino IDE sketch:

[url=http://www.linuxcircle.com/?p=640]http://www.linuxcircle.com/?p=640[/url]

Briliant!  ;D
userHeadPic pratyadi
2013-04-16 15:31:09 So what do I do?

They cant work together?  :o
userHeadPic pratyadi
2013-04-16 09:33:42 Hi pratyadi,

I just check the libraries embeded in the Arduino IDE. You are right.

const uint8_t PROGMEM digital_pin_to_timer_PGM[16] = {
NOT_ON_TIMER,
NOT_ON_TIMER,
NOT_ON_TIMER,
TIMER0B, /* 3 */
NOT_ON_TIMER,
TIMER3A, /* 5 */
TIMER4D, /* 6 */
NOT_ON_TIMER,

NOT_ON_TIMER,
TIMER1A, /* 9 */
TIMER1B, /* 10 */
}

The code above is the digital pin list(using which timer). However....

/**** Servo library definition ******/
#elif defined(__AVR_ATmega32U4__) 
#define _useTimer1

The servo library call timer1 as the time base of the ATmega32U4 servo driving function.... So .... ?

Best
Lauren
userHeadPic Lauren
2013-04-15 17:58:59 I think it is the 'famous' servo  vs PWM conflict problem, because I use A1 to attached a pan servo, and it uses the same timer with Pin 9 & 10 .

As we know typical Leonardo board uses only 3 timers. And Servo uses the samep timer as Pin 9 and 10 and remove their PWM capability.  :P

When I unassigned the servo from the analog pin, pin 9 & 10 work as normal.

Can you confirm that this is the case with Romeo V2?
userHeadPic pratyadi
2013-04-12 23:57:46 Hi pratyadi,

I've already tested the analogWrite function on the digital pin 9-11 of my Romeo v2.0. It works properly, controlling the RGB LED.

So could you please post some details about the code you using or hardware connection? Or try it again?

Best
Lauren
userHeadPic Lauren
2013-04-12 21:42:34 Pin 9 and 10 works like charm when using DigitalRead or DigitalWrite, but not AnalogRead nor AnalogWrite where is should treat it as PWM.

There must be somewhere in Arduino IDE c code that defines a pin as PWM or not.

Can you investigate and test it your self?
userHeadPic pratyadi
2013-04-12 20:26:38 Hi,

Please try analogWrite(9,255) function to test if the PWM pin 9 works.
[url=http://arduino.cc/en/Reference/AnalogWrite]http://arduino.cc/en/Reference/AnalogWrite[/url]

Best
Lauren
userHeadPic Lauren