textLCD.closePhidget()
    except PhidgetException as e:
        print("Phidget Exception %i: %s" % (e.code, e.details))
        print("Exiting....")
        exit(1)
    print("Exiting....")
    exit(1)

try:
    textLCD.setScreenIndex(0)

    #print("Writing to first row....")
    textLCD.setDisplayString(0, "Initialising...")
    sleep(2)

    textLCD.setBacklight(True)
    textLCD.setBrightness(128)

    #print("Writing to second row....")
    textLCD.setDisplayString(1, "Complete!")
    sleep(2)

except PhidgetException as e:
    print("Phidget Exception %i: %s" % (e.code, e.details))
    print("Exiting....")
    exit(1)

print("Press Enter to quit....")

chr = sys.stdin.read(1)
コード例 #2
0
try:
    if textLCD.getDeviceID()==PhidgetID.PHIDID_TEXTLCD_ADAPTER:
        textLCD.setScreenIndex(0)
        textLCD.setScreenSize(TextLCD_ScreenSize.PHIDGET_TEXTLCD_SCREEN_2x8)

    for tweet in stream:
        if 'text' in tweet:
            text = tweet['text']
            if type(text) == str:
                if SEARCHTERM in text.lower():
                    display_tweet.append(text)
            if display_tweet:
                item = display_tweet.pop()

                textLCD.setBacklight(True)
                print item
                row1 = item[:20]
                row2 = item[20:40]
                print("Writing to first row....")
                textLCD.setDisplayString(0, row1)
                print("Writing to second row....")
                textLCD.setDisplayString(1, row2)
                sleep(2)

                print("Turn on cursor....")
                textLCD.setCursor(True)
                sleep(2)

                print("Turn on cursor blink....")
                textLCD.setCursor(False)
コード例 #3
0
    stepper2.setTargetPosition(0, 0)
    stepper3.setTargetPosition(0, 0)
    while stepper.getCurrentPosition(0) != 0:
        pass
    while stepper2.getCurrentPosition(0) != 0:
        pass
    while stepper3.getCurrentPosition(0) != 0:
        pass
    
    """
except PhidgetException as e:
    print("Phidget Exception %i: %s" % (e.code, e.details))
    print("Exiting....")
    exit(1)

textLCD.setBacklight(1)

for i in range (99999999):
    
	slider1=str(interfaceKit.getSensorValue(0))
	joystick_x=str(interfaceKit.getSensorValue(1))
	joystick_y=str(interfaceKit.getSensorValue(2))
	speed=str(interfaceKit.getSensorValue(3))
	
	print("Joystick X: %s Joystick Y: %s Slider Z: %s Speed: %s" % (joystick_x, joystick_y, slider1, speed))
	
	stepper.setVelocityLimit(0, (interfaceKit.getSensorValue(3) * 8 ))
	stepper2.setVelocityLimit(0, (interfaceKit.getSensorValue(3) * 8 ))
	stepper2.setVelocityLimit(0, (interfaceKit.getSensorValue(3) * 8 ))
	
	stepper.setTargetPosition(0, (interfaceKit.getSensorValue(0) * 8 ))