Exemple #1
0
def alert(msg1, msg2 = "", msg3 = ""):
    lcd.setText(msg1, msg2, msg3, pressAckMsg)
    leds.blinkNoGoLeds()
    lcd.setText(readyText)

try:
    while (True):   
        #exit by pressing the Exit button
        # .getData returns the PartWeightResult object
        pw = mySerial.getData(testingMode)

        # no data from scale, keep on truckin' 
        if (pw.hasData == False): continue
    
        lcd.addTextToBottom("Received data:")

        # Data from scale
        # data is good
        if (pw.success):
            #leds.goLed.turnOn()
            lcd.clearText()
            lcd.addTextToBottom("WO: " + pw.workOrderNumber)
            lcd.addTextToBottom("Weight: " + pw.weight)
            
            # send data to webApi and get the result
            lcd.addTextToBottom("Submitting data...", True)
            
            apiResult = webApi.SubmitWeight(pw.workOrderNumber, pw.weight, testingMode)

            # some error occured, but it was (probably already handled, 
def alert(msg1, msg2="", msg3=""):
    lcd.setText(msg1, msg2, msg3, pressAckMsg)
    leds.blinkNoGoLeds()
    lcd.setText(readyText)


try:
    while (True):
        #exit by pressing the Exit button
        # .getData returns the PartWeightResult object
        pw = mySerial.getData(testingMode)

        # no data from scale, keep on truckin'
        if (pw.hasData == False): continue

        lcd.addTextToBottom("Received data:")

        # Data from scale
        # data is good
        if (pw.success):
            #leds.goLed.turnOn()
            lcd.clearText()
            lcd.addTextToBottom("WO: " + pw.workOrderNumber)
            lcd.addTextToBottom("Weight: " + pw.weight)

            # send data to webApi and get the result
            lcd.addTextToBottom("Submitting data...", True)

            apiResult = webApi.SubmitWeight(pw.workOrderNumber, pw.weight,
                                            testingMode)