Main Menu

Motion Servo

Started by goryri, January 06, 2014, 12:37:47 PM

goryri

Hi,
is it posible to use servo whit Motino if so what pin can I use ?


goryri

Tanks but I now how to use a servo but I need a pwm port. I should have asked if there is any spare pwm port on the Motion instead?

LazyGlen

#3
Quote from: goryri on January 07, 2014, 12:20:15 PM
Tanks but I now how to use a servo but I need a pwm port. I should have asked if there is any spare pwm port on the Motion instead?

Wait, what?

Have you looked at the documentation?

http://farm4.staticflickr.com/3818/10585364014_d028c66523_o.png
http://farm4.staticflickr.com/3813/10585334166_d7fc25d846_z.jpg

Pins 3, 5 and 6 are available by default. Pin 9 is connected to the on-board LED, so if you don't mind the LED flashing, you can swap it out. Pin 10 is used by the transceiver, and pin 11 is used for the SPI interface.

[edit]
OK, SO I shot my mouth off then went and looked up some stuff. There is a line in the Arduino Servo Library description http://arduino.cc/en/Reference/Servo that says:
QuoteThe Servo library supports up to 12 motors on most Arduino boards and 48 on the Arduino Mega. On boards other than the Mega, use of the library disables analogWrite() (PWM) functionality on pins 9 and 10, whether or not there is a Servo on those pins.

So apparently, simply using the Servo library precludes PWM on pins 9 and 10. I looked into the RFM69 code and I do not see that the transceiver uses analogWrite on either of these pins, nor would I expect it to, but perhaps Felix can remove any doubt.

The servo does not need to be tied to a PWM pin though - from the same page above:
QuoteThe signal pin is typically yellow, orange or white and should be connected to a digital pin on the Arduino board.
(emphasis mine) It does not state "a PWM pin" and besides, there are not 12 PWM pins anyway.

In an odd turn of events, I was actually playing with my Moteino last night while watching a presentation, and connected a servo to pin 9 to display the readings from my DS18B20 temperature sensors. It worked just fine, although I do remember that the LED was on.

I printed out the two pictures linked above and laminated them back to back so I have something to refer to. Since I was just messing around I didn't pull it out, I just used the default pin from the servo code. I guess I need to remind myself to RTFM as well!  ::)
[/edit]

LG