RP2040 and Servo Not Working

I'm getting this popup whenever uploading a sketch to an RP2040 Connect (multiple boards):

Using the following sketch the connected servo is not working (but does with an Arduino Uno):

#include <Servo.h>

Servo myservo;

int val;

void setup() {
  myservo.attach(4);

  Serial.begin(9600);

  while (!Serial);
}

void loop() {
  val = map(0, 0, 1023, 0, 180); 
  myservo.write(val);
  delay(1000);                           

  val = map(1023, 0, 1023, 0, 180);     
  myservo.write(val);
  delay(1000);

  Serial.println("Test");
}

The board prints to the Serial Monitor. I tried using .attach(4) and .attach(12) as I'm not sure whether D4 or GPIO12 is the pin name.

If you go to the product website, it will teach you what that means and how to do an upload. It is different from an Arduino or ESP.

Here is the link to the hardware docs
https://docs.arduino.cc/tutorials/nano-rp2040-connect/rp2040-01-technical-reference/
and a screen grab explaining why you are seeing that msg.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.