yes of course. This is the way I run my Steppermotor attached to a ballscrew:
Code: Select all
#First stage with a low RPM
def vor():
wid=[0]
for i in range(1):
pi.wave_add_generic([
pigpio.pulse(1<<STEP2, 0, 1350),# microSeconds on
pigpio.pulse(0, 1<<STEP2, 20)]);# microSeconds off
wid[i] = pi.wave_create();
REPEAT = 100 #Total Steps
x=(REPEAT&255)
y=((REPEAT>>8)&255)
pi.wave_chain([
255, 0, # Loop Start
wid[0], # Waveblock
255, 1, x, y, # Loop Repeat = REPEAT
])
#Second Stage with a higher RPM
def vor1():
wid=[0]
for i in range(1):
pi.wave_add_generic([
pigpio.pulse(1<<STEP2, 0, 900),# microSeconds on
pigpio.pulse(0, 1<<STEP2, 20)]);# microSeconds off
wid[i] = pi.wave_create();
REPEAT = 1200#Total Steps
x=(REPEAT&255)
y=((REPEAT>>8)&255)
pi.wave_chain([
255, 0, # Loop Start
wid[0], # Waveblock
255, 1, x, y, # Loop Repeat = REPEAT
])
#Start at low Speed and then the higher Speed
def move():
vor()
vor1()
So i tried something like.
Code: Select all
def move():
pi.hardware_PWM(13, 1000, 128)#PWM on GPIO13
vor()
vor1()
But like you already said this is impossible. What I want to do is in this order:
1.Send PWM to the Steppermotordriver1(GPIO13) so the Stepper1 turns "infinite". One Frequency is enough the Motor don't need to do high
RPM.
2.Send PWM to the Steppermotordriver2(GPIO18) with some stages to achieve a Higher RPM. For Example 200 Steps 600hz = 3 Rotations per
Second and then 2000 Steps at 1000hz. After this I only need to set GPIO12(DirectionPin on the Driveboard) permanent on High and repeat
these two Steps contrariwise to move the ballscrew backwards to its Home Position.
3.After this the Stepper1(GPIO13) is still turning until the User presses a Button or a Switch, to stop the set the PWM on GPIO13.
This may not sound very complicated at all for you, but for it is

Note to Step2.: It does not have to be a PWM Signal necessary. I already got good results with the RPi.GPIO Module to run Steppers at low RPM,with (GPIO18,High), (time.sleep(0.001), (GPIO18,Low),.... But your Module with the Hardware PWM is much better!!