Clovis Fritzen
Published © GPL3+

How fast is Raspberry Pi Pico?

How long it takes for a signal in the input of the Raspberry Pi Pico to activate an output, using code on the Arduino IDE

IntermediateProtip30 minutes379
How fast is Raspberry Pi Pico?

Things used in this project

Story

Read more

Schematics

Schematic in Wokwi, JPEG

Oscilloscope measurements

On the left the Arduino measurement, on the right the microPython one

Code

Code for microPython

MicroPython
Propagation delay code for Thonny IDE on Raspberry Pi Pico
from machine import Pin
import time

led = machine.Pin(17, machine.Pin.OUT)
button = Pin(16, Pin.IN, Pin.PULL_DOWN)

led.off()

while True:
    
         if(button.value()):
             led.on()
         else:
             led.off()

Code for Arduino

Arduino
Propagation delay code for Arduino IDE on Raspberry Pi Pico
// constants won't change. They're used here to set pin numbers:
const int buttonPin = 16;  // the number of the pushbutton pin
const int ledPin = 17;    // the number of the LED pin

// variables will change:
int buttonState = 0;  // variable for reading the pushbutton status

void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT_PULLDOWN);
}

void loop() {
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pressed. If it is, the buttonState is HIGH:
  if (buttonState == HIGH) {
    // turn LED on:
    digitalWrite(ledPin, HIGH);
  } else {
    // turn LED off:
    digitalWrite(ledPin, LOW);
  }
}

Credits

Clovis Fritzen

Clovis Fritzen

2 projects • 5 followers
Electrical engineer and maker from Brazil

Comments