Commit 6d9a2d51 authored by Marlene Böhmer's avatar Marlene Böhmer

update lib, scripts

parent 25e6f327
Subproject commit e919a485260a9da2f115a2c91d5cc7768023187c
Subproject commit 7871841272503dc8d05a583956b92cb152378a7f
#!/usr/bin/python
import time
import pigpio
I2C_ADDR=0x22 # 34
def i2c(id, tick):
global pi
s, b, d = pi.bsc_i2c(I2C_ADDR)
print("status={:021b} received={} {}".format(s, b, list(d)))
pi = pigpio.pi()
if not pi.connected:
exit()
# Respond to BSC slave activity
e = pi.event_callback(pigpio.EVENT_BSC, i2c)
pi.bsc_i2c(I2C_ADDR) # Configure BSC as I2C slave
time.sleep(3600)
e.cancel()
pi.bsc_i2c(0) # Disable BSC peripheral
pi.stop()
......@@ -24,6 +24,30 @@ if __name__ == '__main__':
# We take off when the commander is created
with MotionCommander(scf) as mc:
print('Taking off!')
time.sleep(0.1)
time.sleep(1)
# There is a set of functions that move a specific distance
# We can move in all directions
print('Moving forward 0.5m')
mc.forward(0.5)
# Wait a bit
time.sleep(1)
print('Moving up 0.2m')
mc.up(0.2)
# Wait a bit
time.sleep(1)
print('Doing a 180deg circle')
mc.circle_right(0.1, velocity=0.1, angle_degrees=180)
print('Moving down 0.2m')
mc.down(0.2)
# Wait a bit
time.sleep(1)
print('Moving forward 0.5m')
mc.forward(0.5)
# We land when the MotionCommander goes out of scope
print('Landing!')
print('Landing!')
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment