Controlling servos with RedBoard Artemis Nano

I have the following set up working on an Arduino Uno.

https://aws1.discourse-cdn.com/arduino/ … 4db34.jpeg

I’m trying to replicate this set up on a RedBoard Artemis Nano. However, when I make the connections and upload my program (see below), the servo doesn’t move. Possibly I’ve misread the capabilities of the Nano, but should this work?

#include <Servo.h>

Servo servo;
int servo_pin = 9;

void setup ()
{
  Serial.begin(115200);

  delay(400);
  servo.attach(servo_pin); 
}

void loop()
{
  Serial.println("Loop");

  servo.write(0);
  delay(4000);

  servo.write(90);
  delay(4000);

  servo.write(180);
  delay(4000);

  servo.write(90);
  delay(4000);
}

Hi, I can see that in your diagram, the control pins of the two servo motors are connected to pin 7 and pin 8. But in your code, I can see only one servo. That has its control pin connected to pin 9.

What is the setup with your Artemis actually? Are you connecting the servo’s control pin to pin#9?

The servo steps are generated by one of the timers in the Apollo3 chip, redirected to a GPIO pin. Not all GPIO pins can be connected to a timer output. The table in chapter 13.20 of the Apollo3 datasheet shows which, but to keep it easy the library also mentions that the following pads are valid for output: Valid pads for CTx are: 4-7, 11-13, 18-19, 22-33, 35, 37, 39, 42-49.

Often the PAD is the same as the PIN number printed on the board. However looking at an Artemis Nano :

D0 = A0 = 13, OK

D1 = A1 = 33, OK

D2 = A2 = 11, OK

D3 = A3 = 29, OK

D4 = 18, OK

D5 = A5 = 31, OK

D6 = 43, OK

D7 = 42, OK

D8 = 38, NO

D9 = 39, OK

D10 = 40, NO

D11 = 5, OK

D12 = 7, OK

D13 = 6, OK

D14 = A14 = 35, OK

D15 = A15 = 32, OK

D16 = A16 = 12, OK

Select one from the list.

Thanks guys. Sorry, I took the wiring diagram from another site, but I can confirm I am connected to pin 9.

Pin 9 also appears to be a valid pin according to @paulvha’s list.

So it seems it should be possible, but it’s still not working on my Nano. Could it just be a faulty board?

you need to set D9, not 9. You can also try another pin.