1. Raspberry Pi Pico W Overview

The Raspberry Pi Pico W is a low-cost microcontroller board based on the RP2040 chip. It features:

c

The Pico W’s datasheet outlines power management, GPIO assignments, and communication protocols essential for embedded systems.

2. Components

3. Circuit Connections

The stepper motor is connected to the A4988 driver, which is controlled by the Arduino.

c

4. Arduino Code


        
#define DIR_PIN 2
#define STEP_PIN 3
#define POT_PIN 28 

void setup() {
  pinMode(STEP_PIN, OUTPUT);
  pinMode(DIR_PIN, OUTPUT);
  digitalWrite(STEP_PIN, LOW);
}

void loop() {
  int potValue = analogRead(POT_PIN);
  int stepDelay = map(potValue, 0, 1023, 1, 10);


  digitalWrite(DIR_PIN, HIGH);
  for (int i = 0; i < 200; i++) {
    digitalWrite(STEP_PIN, HIGH);
    digitalWrite(STEP_PIN, LOW);
    delay(stepDelay);
  }

  delay(500); 


  digitalWrite(DIR_PIN, LOW);
  for (int i = 0; i < 200; i++) {
    digitalWrite(STEP_PIN, HIGH);
    digitalWrite(STEP_PIN, LOW);
    delay(stepDelay);
  }

  delay(1000); 
}