def main(): parser = argparse.ArgumentParser() parser.add_argument('-c', '--clear', action='store_true', help='clear the display on exit') args = parser.parse_args() try: while True: strandtest.setColors([0, 0, 100], 10, 20, 18) time.sleep(5) strandtest.setColors([0, 0, 100], 30, 20, 18) time.sleep(5) except KeyboardInterrupt: if args.clear: colorWipe(strip, Color(0, 0, 0), 10)
def litLEDs(self, loc): #Sets the correct pin assignment based on the aisle and row of the item to light up the proper section pinLoc = 0 if (listOfItems[loc].locAisle == '1' and listOfItems[loc].locRow == '1'): pinLoc = 12 #Changed from pin 21 elif (listOfItems[loc].locAisle == '1' and listOfItems[loc].locRow == '2'): pinLoc = 18 #Chnaged form pin 20 elif (listOfItems[loc].locAisle == '2' and listOfItems[loc].locRow == '1'): pinLoc = 16 elif (listOfItems[loc].locAisle == '2' and listOfItems[loc].locRow == '2'): pinLoc = 15 strandtest.setColors(user.RGBW, int(float((listOfItems[loc].locCol)) * 10), 20, pinLoc) time.sleep(5) strandtest.setColors([0, 0, 0], 0, 60, pinLoc)
def clientCheckItems(self): self.addItemButton.destroy() self.removeItemButton.destroy() self.printListButton.destroy() self.checkMisplacedButton.destroy() self.logOffButton.destroy() self.text.destroy() self.scrollbar = Scrollbar(self) self.scrollbar.pack(side=RIGHT,fill=Y) self.listbox = Listbox(self,width=40,height=20) self.listbox.pack(fill=BOTH,expand=True) self.listbox.config(yscrollcommand=self.scrollbar.set) self.scrollbar.config(command=self.listbox.yview) self.returnButton = Button(self,text='Return',font=("Times",14),command=lambda ty = 6: self.clientEmployee(ty),height=2,width=5) self.returnButton.place(relx=.825,rely=.775) self.checkButton = Button(self,text='Check Again',font=("Times",14),command=self.checkAgain,height=2,width=8) self.checkButton.place(relx=.025,rely=.775) misplaced = -1 i=0 colorSensor=ColorSensorTest.ColorSensor() #print colorSensor if(colorSensor[3] != 0):#fFSR ==1 while(i < 3): if(colorSensor[i] <= 5): self.listbox.insert(END,'Item at Row: 1 and Column: %s is misplaced'%(i+1)) self.listbox.insert(END,'Item at Row: 2 and Column: %s is misplaced'%(i+1)) misplaced = i i+=1 #light up the led at locations print misplaced if(misplaced != -1): pinLoc = 12 strandtest.setColors2([255,0,0],int(misplaced),20,pinLoc) time.sleep((5)) strandtest.setColors([0,0,0],int(misplaced),20,pinLoc)
def litLEDs(self,loc): #Sets the correct pin assignment based on the aisle and row of the item to light up the proper section pinLoc = 12 #Changed from 0 if(listOfItems[loc].locAisle == '1' and listOfItems[loc].locRow == '1'): pinLoc = 12 #Changed from 16 strandtest.setColors(user.RGBW,int(40-20*(float((listOfItems[loc].locCol))-1)),20,pinLoc) elif(listOfItems[loc].locAisle == '1' and listOfItems[loc].locRow == '2'): pinLoc = 12 #Changed from 20 strandtest.setColors(user.RGBW,int(82+(40-20*(float((listOfItems[loc].locCol))-1))),20,pinLoc) #elif(listOfItems[loc].locAisle == '2' and listOfItems[loc].locRow == '1'): # pinLoc = 18 #elif(listOfItems[loc].locAisle == '2' and listOfItems[loc].locRow == '2'): # pinLoc = 18 #strandtest.setColors(user.RGBW,int(float((listOfItems[loc].locCol))),20,pinLoc) time.sleep(5) strandtest.setColors([0,0,0],0,60,pinLoc)
def runLEDS(user,listOfItems,location,stripPin): #Runs the LEDs to light up for a period of time strandtest.setColors(user.RGB,int(float((listOfItems[location].locCol))*10),20,stripPin) time.sleep(5) strandtest.setColors([0,0,0],0,60,stripPin)
def main(): #Make a list to hold the values of the aisle listOfItems = [] arrayOfItems = [] #Get an array of the items from the txt file arrayOfItems = ReadDatabase.readWrittenList() #iterate through that array to populate the list of items i = 0 while i < len(arrayOfItems) - 4: itemName = arrayOfItems[i] i += 1 locAisle = arrayOfItems[i] i += 1 locCol = arrayOfItems[i] i += 1 locRow = arrayOfItems[i] i += 1 listOfItems.append(Item(itemName, locCol, locRow, locAisle)) printList(listOfItems) #While loop to make sure the code doesn't stop unless it is killed while (1): #Need to get input of what kind of user they are with authentification userType = raw_input( 'What kind of user are you? Customer or Employee? \n') if (userType.lower() == 'customer' or userType.lower() == 'employee'): loggedIn = 'yes' #While loop while the user is logged into a specific area while (loggedIn == 'yes'): #Find what they want to do if (userType.lower() == 'employee'): password = raw_input('Password: '******'123'): while (loggedIn == 'yes'): empAct = raw_input( 'Would you like to add new objects(1) or monitor misplaced items(2) or delete an item(3) or print the list(4) or log out(5)? ' ) print '\n' #if they are employee and in the placement mode if (empAct == '1'): #Find out all of the information from the employee and make an item and set it in the array itemName = raw_input( 'What is the name of the item?(Full name of item) ' ) print '\n' aisle = raw_input( 'What aisle is it in?(Number location 1) ') print '\n' aisleCheck = 0 #Double check that the aisle exists while (aisleCheck == 0): if ((aisle == '1')): aisleCheck = 1 else: aisle = raw_input( "The desired aisle doesn't exist, try again " ) print '\n' #Check that the column input exists locCol = raw_input( 'What column is it in?(Number location 1-3) ' ) print '\n' colCheck = 0 while (colCheck == 0): if (locCol == '1' or locCol == '2' or locCol == '3'): colCheck = 1 else: locCol = raw_input( "The desired column doesn't exist, try again " ) print '\n' #Check that the row actually exists locRow = raw_input( 'What row is it in?(Number location 1-2) ') print '\n' rowCheck = 0 while (rowCheck == 0): if (locRow == '1' or locRow == '2'): rowCheck = 1 else: locRow = raw_input( "The desired row doesn't exist, try again " ) print '\n' #Check to make sure no other item is in the slot locationUsed = Search.searchLocationList( listOfItems, aisle, locRow, locCol) if (locationUsed == -1): #Add in the new item to the array #WNTBD find the weight of the item from the FSR code #WNTBD find the color differences and save what is needed listOfItems.append( Item(itemName, locCol, locRow, aisle)) #Double check the item that is being added print 'Here is the item you just registered \nName %s\nAisle %s\nColumn %s\nRow %s\n' % ( listOfItems[(len(listOfItems) - 1)].name, listOfItems[(len(listOfItems) - 1)].locAisle, listOfItems[(len(listOfItems) - 1)].locCol, listOfItems[(len(listOfItems) - 1)].locRow) UpdateDatabase.updateWrittenList( listOfItems) else: print 'Location is already being used, nothing was done.\n' if (empAct == '2'): #This is where we will continually look for another input while checking the other sets for anything misplaced(WNTBD) #WNTBD How can we take a kill input while it runs other code? iteration = 0 #for item in listOfItems: # misplaced = 0 #if(listOfItems[iteration].weight != FSR check at the location) # misplaced = 1 #if(listOfItems[iteration].color != Check color sensor at location) # misplaced += 1 # #if(misplaced == 2): # print 'There is an item misplaced in Aisle %s, Row %s, Column %s'%(listOfItems[iteration].locAisle,listOfItmes[iteration].locRow,listOfItems[iteration].locCol) #iteration+=1 check = 0 if (empAct == '3'): delete = raw_input( 'What is name of the item you would like to delete from the inventory? ' ) print '\n' location = Search.searchListDel( listOfItems, delete) #Check to make sure that the item exists if (location != -1): #Takes out the item and allows us to see the deleted item item = listOfItems.pop(location) print '%s item has been removed.\n' % ( item.name) UpdateDatabase.updateWrittenList( listOfItems) else: print "That item didn't exist in our inventory.\n" if (empAct == '4'): printList(listOfItems) if (empAct == '5'): loggedIn = 'no' print 'Logged off\n\n' #Find if the user is a customer if (userType.lower() == 'customer'): #Now we need to make a profile for them username = raw_input( 'What username would you like to use? ') print '\n' userColor = '0' colorCheck = 0 #Go through the checking process for what color they want to use while (colorCheck == 0): userColor = raw_input( 'What color would you like to light up with?(red, green, blue, white, yellow, purple): ' ) print '\n' if (userColor.lower() == 'red' or userColor.lower() == 'green' or userColor.lower() == 'blue' or userColor.lower() == 'white' or userColor.lower() == 'yellow' or userColor.lower() == 'purple'): colorCheck = 1 else: locRow = raw_input( "The desired color doesn't exist, try again ") print '\n' #Set the username and the color user = User(username, userColor) while (loggedIn == 'yes'): userAction = raw_input( 'Would you like to Search(1) or log out(2)? ') print '\n' if (userAction == '1'): location = Search.searchNameList(listOfItems) if (location != -1): print '%s, we found %s in the inventory.\n' % ( user.userName, listOfItems[location].name) print '%s can be found in Aisle %s, Row %s, and Column %s\n' % ( listOfItems[location].name, listOfItems[location].locAisle, listOfItems[location].locRow, listOfItems[location].locCol) search = raw_input( 'Would you like the item location to light up? (y or n): ' ) print '\n' while (search == 'y'): #Runs the LEDs to light up for a period of time strandtest.setColors( user.RGB, int( float( (listOfItems[location].locCol)) * 10), 20, 21) time.sleep(5) strandtest.setColors([0, 0, 0], 0, 60, 21) #Run the LED code for dark across all of them search = raw_input( 'Would you like to light the item location up again?(y or n): ' ) else: print '%s, unfortunately that item is not in our stock.\n' % ( user.userName) if (userAction == '2'): loggedIn = 'no' print 'Logged off\n\n' if (userType.lower() != 'customer' and userType.lower() != 'employee'): print 'Your input was invalid\n'
def main(): parser = argparse.ArgumentParser() parser.add_argument('-c', '--clear', action='store_true', help='clear the display on exit') args = parser.parse_args() try: while True: #Top strandtest.setColors([0, 100, 0], 0, 20, 12) time.sleep(1) strandtest.setColors([100, 0, 0], 20, 20, 12) time.sleep(1) strandtest.setColors([0, 0, 100], 40, 20, 12) time.sleep(1) strandtest.setColors([0, 100, 0], 59, 20, 12) time.sleep(1) #Bottom strandtest.setColors([0, 100, 0], 82, 20, 12) time.sleep(1) strandtest.setColors([100, 0, 0], 102, 20, 12) time.sleep(1) strandtest.setColors([0, 0, 100], 122, 20, 12) time.sleep(1) #strandtest.setColors([0,100,0],30,20,12) #time.sleep(1) strandtest.setColors([0, 100, 0], 141, 20, 12) time.sleep(1) except KeyboardInterrupt: if args.clear: colorWipe(strip, Color(0, 0, 0), 10)