| 
																	
																	
																		
																			
																		
																	
																	
																 | 
																@ -4,7 +4,7 @@ LED3_PATH = "/sys/class/leds/beaglebone:green:usr3" | 
															
														
														
													
														
															
																 | 
																 | 
																
 | 
																 | 
																 | 
																
 | 
															
														
														
													
														
															
																 | 
																 | 
																def write2LED(fileName, value, path=LED3_PATH): | 
																 | 
																 | 
																def write2LED(fileName, value, path=LED3_PATH): | 
															
														
														
													
														
															
																 | 
																 | 
																    """This function writes the passed value to the file in the path""" | 
																 | 
																 | 
																    """This function writes the passed value to the file in the path""" | 
															
														
														
													
														
															
																 | 
																 | 
																    fo = open(path + filename,"w") | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																    fo = open(path + fileName,"w") | 
															
														
														
													
														
															
																 | 
																 | 
																    fo.write(value) | 
																 | 
																 | 
																    fo.write(value) | 
															
														
														
													
														
															
																 | 
																 | 
																    fo.close() | 
																 | 
																 | 
																    fo.close() | 
															
														
														
													
														
															
																 | 
																 | 
																    return | 
																 | 
																 | 
																    return | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																			
																		
																	
																 | 
																@ -12,5 +12,24 @@ def write2LED(fileName, value, path=LED3_PATH): | 
															
														
														
													
														
															
																 | 
																 | 
																def removeTrigger(): | 
																 | 
																 | 
																def removeTrigger(): | 
															
														
														
													
														
															
																 | 
																 | 
																    write2LED("/trigger", "none") | 
																 | 
																 | 
																    write2LED("/trigger", "none") | 
															
														
														
													
														
															
																 | 
																 | 
																    return | 
																 | 
																 | 
																    return | 
															
														
														
													
														
															
																 | 
																 | 
																
 | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																#Application Begin: | 
															
														
														
													
														
															
																 | 
																 | 
																print("Starting the LED Python Script")  | 
																 | 
																 | 
																print("Starting the LED Python Script")  | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																if len(sys.argv)!=2: | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																    print("Incorrect number of arguments") | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																    sys.exit(2) | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																
 | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																#More than one argument: | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																if sys.argv[1]=="on": | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																    print("LED on") | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																    removeTrigger() | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																    write2LED("/brightness", "1") | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																elif sys.argv[1]=="off": | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																    print("LED off") | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																    removeTrigger() | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																    write2LED(fileName="/brightness", value="0") | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																else: | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																    print("Wrong command") | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																
 | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																
 | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																
 | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																print("End of Script") |