Posts by advancetom

    #!/usr/bin/python
    import serial
    import time
    import sys
    import getopt

    from Adafruit_BMP085 import BMP085

    # ===========================================================================
    # Example Code
    # ===========================================================================

    # Initialise the BMP085 and use STANDARD mode (default value)
    # bmp = BMP085(0x77, debug=True)
    bmp = BMP085(0x77)

    # To specify a different operating mode, uncomment one of the following:
    # bmp = BMP085(0x77, 0) # ULTRALOWPOWER Mode
    # bmp = BMP085(0x77, 1) # STANDARD Mode
    # bmp = BMP085(0x77, 2) # HIRES Mode
    # bmp = BMP085(0x77, 3) # ULTRAHIRES Mode

    temp = bmp.readTemperature()
    pressure = bmp.readPressure()
    altitude = bmp.readAltitude()

    print "Temperature: %.2f C" % temp
    print "Pressure: %.2f hPa" % (pressure / 100.0)
    print "Altitude: %.2f" % altitude

    try:
    opts, args = getopt.getopt(sys.argv[1:], "x:y:s:b")
    except getopt.GetoptError, err:
            # print help information and exit:
            print str(err) # will print something like "option -a not recognized"
            sys.exit(2)

    x=0
    y=0
    s=""
    clear = False

    for o, a in opts:
            if o == "-x":
    x = a
            elif o == "-y":
    y = a
            elif o == "-s":
    s = a
            elif o == "-b":
    clear = True
            else:
                    assert False, "Unhandled option"

    # Open the serial port on J16

    ser = serial.Serial(
    port='/dev/ttyUSB0',
    baudrate=115200,
    timeout=1,
    parity=serial.PARITY_NONE,
    stopbits=serial.STOPBITS_ONE,
    bytesize=serial.EIGHTBITS
    )

    ser.write("U")          # Autobaud char
    rtc = ser.read(1)       # Wait for a reply

    if clear==True:
    ser.write("E")          # Clear screen
    rtc = ser.read(1)       # Wait for a reply

    ser.write("s%c%c%c%c%c%s%c" % (int(x),int(y),1,0xFF,0xFF,s,0x00))
    rtc = ser.read(1)       # Wait for a reply
    time.sleep(30)  
    ser.close()                     # Close Port


    Wie bekomme ich die werte vom BMP085 auf das Display?
    Sorry ich bin noch neu auf der python Ebene:s