diff --git a/Versuch 2/servoblaster_ctl.py b/Versuch 2/servoblaster_ctl.py index e69de29..97fd54e 100644 --- a/Versuch 2/servoblaster_ctl.py +++ b/Versuch 2/servoblaster_ctl.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python +import os + +def sb_write(fd, servo, pulse): + try: + os.write(fd, '%d=%d\n' % (servo,pulse)) + except IOError as e: + print e + +try: + fd = os.open('/dev/servoblaster', os.O_WRONLY) +except OSError as e: + print 'could not open /dev/servoblaster' + raise SystemExit(5) +except (KeyboardInterrupt, SystemExit): + os.close(fd) + pass + + diff --git a/Versuch 3/wiikt_main.py b/Versuch 3/wiikt_main.py index cec81ac..e0243dd 100644 --- a/Versuch 3/wiikt_main.py +++ b/Versuch 3/wiikt_main.py @@ -80,6 +80,7 @@ try: delta = 1.0 / 50 print("({},{} --> {})".format(car.speed_cur, car.angle_cur, (car.speed_cur - car.speed_last) / delta)) + ", Servo_active: " + str(car.is_testmode_servo_active) + "CC Speed: " str(car.speed_cruise_control) + sleep(1 / 50) except KeyboardInterrupt: print "Exiting through keyboard event (CTRL + C)"