print "Conn: ", conn config.init() shutdown = 0 bus = smbus.SMBus(1) bmp085 = BMP085(bus,0x77,"BMP085") gyro = SensorITG3200(1,0x68) gyro.default_init() zeroX,zeroY,zeroZ = gyro.calibrate(1000,0.002) print 'Compass Initialization ... [Ok]' compass = SensorHMC5338L(1,0x1e) # Accelerometer: # 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'])
print "Conn: ", conn config.init() shutdown = 0 bus = smbus.SMBus(1) bmp085 = BMP085(bus, 0x77, "BMP085") gyro = SensorITG3200(1, 0x68) gyro.default_init() zeroX, zeroY, zeroZ = gyro.calibrate(1000, 0.002) print 'Compass Initialization ... [Ok]' compass = SensorHMC5338L(1, 0x1e) # Accelerometer: # 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'])
if __name__ == "__main__": config.init() shutdown = 0 bus = smbus.SMBus(1) bmp085 = BMP085(bus,0x77,"BMP085") gyro = SensorITG3200(1,0x68) gyro.default_init() zeroX,zeroY,zeroZ = gyro.calibrate(1000,0.002) print 'Compass Initialization ... [Ok]' compass = SensorHMC5338L(1,0x1e) # Accelerometer: # 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: input = raw_input("") if input == 'q': exit() if input == 'a': axes = adx.getAxes() axesG = adx.toG(axes) print "\n\nAcc X: ", axes['x'] , "m/s^2" print "Acc X: ", axesG['x'], "G\t" print "\n\nAcc Y: ", axes['y'] , "m/s^2" print "Acc Y: ", axesG['y'], "G\t"