Delay?

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
MaT2015
Posts: 1
Joined: Thu Jun 14, 2018 6:20 am

Delay?

Post by MaT2015 » Thu Jun 14, 2018 7:13 am

I have tried to use the delay function/word on the online demo, error message says does not exist, delay in ms.

pyb.delay(ms)


# Using the Servo
# Make sure you have the Servo checkbox marked!

import machine
import pyb

# The pyboard has four simple servo connections
servo = pyb.Servo(1)

servo.angle(90, 5000)
pyb.delay(1000) # I also tried delay(1000)
servo.angle(1000)

User avatar
dhylands
Posts: 2777
Joined: Mon Jan 06, 2014 6:08 pm
Location: Shuswap, BC, Canada
Contact:

Re: Delay?

Post by dhylands » Thu Jun 14, 2018 4:32 pm

Which board are you using?

This example works fine on the pyboard: https://github.com/dhylands/upy-example ... artbeat.py

For the ESP32 or ESP8266, there is no pyb module. You should be getting an error on the "import pyb" statement. Instead use the time.sleep_ms() function.

Post Reply