Raspberry pi 2 - can't time.sleep() for a millisecond - Raspberry Pi Forums


i'm trying make stepper motor spin raspberry pi 2, works it's extremely slow (around 70 seconds 1 revolution).

started investigating , turns out when in python time.sleep(0.001) takes 20 milliseconds!

following code (sleep millisecond thousand times) takes 20 seconds run:

code: select all

import time  start = time.time() x in xrange(1000):     time.sleep(0.001) print time.time() - start 
know it's python , it's slow , shouldn't expect code take 1 second 20 seconds seems way slow.

in following tutorial guy using python code time.sleep(0.001) control stepper motor , takes around 5 seconds make full revolution, guy using rapsberry pi 1.

code:
https://www.youtube.com/watch?v=dc16mkfa7fo&t=8m37s

motor spins:
http://www.youtube.com/watch?v=dc16mkfa7fo&t=9m5s

makes me think problem raspberry pi 2.. right? or impossible sleep millisecond python (and in case - how did guy in video did it?)

i tried example on pi (1). result 1.12 , something. so, problem must in pi 2 , not in python or linux in general.

edit: there bug causing this: http://www.raspberrypi.org/forums/viewt ... 25#p684221

edit_2: should fixed already. http://www.raspberrypi.org/forums/viewt ... 00#p686269

try updating , upgrading raspbian.


raspberrypi



Comments

Popular posts from this blog

VIDIOC_S_FMT error 16, Device or resource busy - Raspberry Pi Forums

using a laptop skeleton to build a pi laptop - Raspberry Pi Forums

Forum for Joomla? - Joomla! Forum - community, help and support