Exemple #1
0
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, 
            # so just get on with things
            if (apiResult == None): 
                lcd.setText(readyText)
                continue
  
            #apiResult.status=404 
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,
            # so just get on with things
            if (apiResult == None):
                lcd.setText(readyText)
                continue