#try: import mpu9250 #except: # print("import mpu9250 mislukt") import Adafruit_BBIO.GPIO as GPIO import time import os print("initialising GPIOS") GPIO.setup("P8_15", GPIO.OUT) GPIO.output("P8_15", GPIO.HIGH) GPIO.setup("P8_11", GPIO.OUT) GPIO.output("P8_11", GPIO.LOW) try: mp1 = mpu9250.SL_MPU9250(0x68, 2) mp2 = mpu9250.SL_MPU9250(0x69, 2) except: print( "IMU's : Failed to import or execute mpu9250 library, IMU is probably not connected rightly" ) filename = "dataSpeedTest" data = open(filename + '.txt', 'a+') sampleTime = 5 timeout = time.time() + sampleTime print("started") time.sleep(1) while True: try: ax1, ay1, az1 = mp1.getAccel()
import Adafruit_BBIO.GPIO as GPIO import mpu9250 import time import os #*********SETUP*********# try: mp=mpu9250.SL_MPU9250(0x69, 2) except: print("First IMU (in Setup) not found") footLeft = "P8_7" footRight = "P8_8" tibiaLeft = "P8_9" tibiaRight = "P8_10" thighLeft = "P8_11" thighRight = "P8_12" handLeft = "P8_14" handRight = "P8_15" forearmLeft = "P8_16" forearmRight = "P8_17" bicepsLeft = "P8_18" bicepsRight = "P8_26" backLeft = "P9_12" backRight = "P9_15" backPelvis = "P9_23" frontSternum = "P9_25" frontBellybutton = "P9_27" frontPelvis = "P9_30" head = "P9_41"
import Adafruit_BBIO.GPIO as GPIO import mpu9250 import time mp=mpu9250.SL_MPU9250(0x68, 2) adPin="P8_7" adPin1="P8_8" GPIO.setup(adPin, GPIO.OUT) GPIO.setup(adPin1, GPIO.OUT) GPIO.output(adPin, GPIO.LOW) GPIO.output(adPin1, GPIO.HIGH) print("Eerste is Low nu voor 5 sec") timeout= time.time()+5 while True: if time.time() > timeout: break ax1, ay1, az1 = mp.getAccel() time.sleep(0.1) print "Az1: ", az1 GPIO.output(adPin, GPIO.HIGH) GPIO.output(adPin1, GPIO.LOW) timeout= time.time()+5 #mp=mpu9250.SL_MPU9250(0x68, 2) print("ANDERE********************************************") time.sleep(2) while True: