performance problems with writeDigitalPin function

Hi, i want to use my raspberry pi to control a stepper motor with matlab. Therefore i wrote a loop to control the pins ( with function: writeDigitalPins(...) )
My problem is, that this function really slows my loop down (to slow to get the needed frequency). I tried the same code as a standalone version with Python, where the performance was much better. So i am pretty sure the reason must be the write-function of matlab.
Does anyone knows how i can improve the performance? Thanks in advance.
The time (for one iteration) with 'writeDigitalPin()' = 2.6 seconds The time without : 0.5 seconds
The loop:
seq = [1 0 0 1;
1 1 0 0;
0 1 1 0;
0 0 1 1];
for i =1:1:1
for i2 = 1:1:4
writeDigitalPin(mypi,14,seq(i2,1))
writeDigitalPin(mypi,15,seq(i2,2))
writeDigitalPin(mypi,18,seq(i2,3))
writeDigitalPin(mypi,23,seq(i2,4))
end
end

답변 (0개)

카테고리

도움말 센터File Exchange에서 Raspberry Pi Hardware에 대해 자세히 알아보기

질문:

2016년 2월 23일

편집:

2016년 2월 23일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by