示例#1
0
    # adxl(i2c_adapter,bus_nr,resolution)
    # resolution:      [0,1,2,3] for [2g,4g,8g,16g]

    adx = Adxl(1, 0x53, 0)
    helpInfo()

    while not shutdown == 1:
        data = []
        data.append(adx.getRoll())
        data.append(adx.getPitch())
        data.append(compass.getBearing())
        time.sleep(0.1)
        send_array(conn, data)
        continue

        axes = adx.getAxes()
        gx, gy, gz = gyro.read_data_calib()
        mx, my, mz = compass.read_data()
        data.append(axes['x'])
        data.append(axes['y'])
        data.append(axes['z'])
        data.append(gx)
        data.append(gy)
        data.append(gz)
        data.append(mx)
        data.append(my)
        data.append(mz)
        time.sleep(0.1)
        send_array(conn, data)
#		wait_for_ack(conn);
示例#2
0
	# adxl(i2c_adapter,bus_nr,resolution)
	# resolution:      [0,1,2,3] for [2g,4g,8g,16g]

    	adx = Adxl(1,0x53,0)
	helpInfo()	
	
	while not shutdown == 1:
		data = []
		data.append(adx.getRoll())
		data.append(adx.getPitch())
		data.append(compass.getBearing())
		time.sleep(0.1)
		send_array(conn, data)
		continue		

		axes = adx.getAxes()
		gx,gy,gz = gyro.read_data_calib()
		mx,my,mz = compass.read_data()
		data.append(axes['x'])
		data.append(axes['y'])
		data.append(axes['z'])
		data.append(gx)
		data.append(gy)
		data.append(gz)
		data.append(mx)
		data.append(my)
		data.append(mz)
		time.sleep(0.1)
		send_array(conn, data)
#		wait_for_ack(conn);