Strobo
This commit is contained in:
		
							
								
								
									
										33
									
								
								apps/strobo.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										33
									
								
								apps/strobo.py
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,33 @@
 | 
				
			|||||||
 | 
					#!/usr/bin/env python3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import os
 | 
				
			||||||
 | 
					import sys
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Nx = int(sys.argv[1])
 | 
				
			||||||
 | 
					Ny = int(sys.argv[2])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					param = 10
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					try:
 | 
				
			||||||
 | 
					    param = int(sys.argv[3])
 | 
				
			||||||
 | 
					except:
 | 
				
			||||||
 | 
					    pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					a = True
 | 
				
			||||||
 | 
					counter = 0
 | 
				
			||||||
 | 
					buffera = bytearray(b"\x00" * (3 * Nx * Ny))
 | 
				
			||||||
 | 
					bufferb = bytearray(b"\xFF" * (3 * Nx * Ny))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					while True:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if a:
 | 
				
			||||||
 | 
					        os.write(1, buffera)
 | 
				
			||||||
 | 
					    else:
 | 
				
			||||||
 | 
					        os.write(1, bufferb)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if param == counter:
 | 
				
			||||||
 | 
					        a = not a
 | 
				
			||||||
 | 
					        counter = 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    counter+=1
 | 
				
			||||||
		Reference in New Issue
	
	Block a user