Example #1
0
import dshot
#import time
"""
This sends a 0 throttle (value 48) to pins 5, 7, 19 and 20 for a little
while, then 51 (value 99) which should start the motors turning, then 151
(199) which should make them turn a little faster.

These pins worked for me with the Sense HAT attached.
"""

while True:
    dshot.send(48, 12)

#    time.sleep(.2)

#for _ in range(10000):
#    dshot.send(99, 12) # 26 32 12
#dshot.send(48, 7)
#dshot.send(48, 19)
#dshot.send(48, 20)

#for _ in range(20000):
#    dshot.send(99, 5)
#    dshot.send(99, 7)
#    dshot.send(99, 19)
#    dshot.send(99, 20)
#
#for _ in range(10000):
#    dshot.send(199, 5)
#    dshot.send(199, 7)
#    dshot.send(199, 19)
Example #2
0
import dshot

dshot.send(2, 2)
dshot.send(2, 2)
dshot.send(2, 2)
MAX_SPEED = 2000
MIN_SPEED = 50
NULL_SPEED = 48
PIN_OUT = 5
Dt = 12
increment = 30
NO_TELEM = 0
ON_TELEM = 1

t = time.time() * 1000
t1 = t
speed = NULL_SPEED

for _ in range(10000):
    dshot.send(NULL_SPEED, PIN_OUT, NO_TELEM)
    time.sleep(0.00012)

while (1):
    t = time.time() * 1000
    if (abs(t - t1) > Dt):
        dshot.send(speed, PIN_OUT, NO_TELEM)
        t1 = t
        speed += increment
        if (increment > 0):
            print("Increase: ", speed)
        if (increment < 0):
            print("Decrease: ", speed)
        if (speed > MAX_SPEED):
            increment = (-1) * increment
            speed += increment
Example #4
0
import dshot

for _ in range(10000):
    dshot.send(48, 19)
    dshot.send(48, 5)
    dshot.send(48, 7)
    dshot.send(48, 20)

for _ in range(20000):
    dshot.send(99, 19)
    dshot.send(99, 5)
    dshot.send(99, 7)
    dshot.send(99, 20)

for _ in range(10000):
    dshot.send(199, 19)
    dshot.send(199, 5)
    dshot.send(199, 7)
    dshot.send(199, 20)