Animate a connect status = boolean: start or stop animation status = int: aimate for this number of seconds leav_this = Do not clear, paint this instead ''' global leav_this_on_stop leav_this_on_stop = None if type(status) == types.BooleanType: if status: animate_start(matrix_animate_connect, rotate, 0.1) else: animate_stop() else: animate_start(matrix_animate_connect, rotate, 0.1) steelsquid_utils.execute_delay(status, animate_stop) if __name__ == "__main__": if len(sys.argv)==1: from steelsquid_utils import printb print("") printb("lmatrix test") print("Write a test") print("") else: if sys.argv[1]=='test': animate_connect(True) raw_input("Press Enter to continue...")
self.ser = serial.Serial(self.serial_port, self.baudrate, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=8, writeTimeout=0, dsrdtr=True) #print str(left)+"|"+str(right) def stop(self): ''' Stop this controller. ''' ser.close() if __name__ == "__main__": if len(sys.argv)==1: from steelsquid_utils import printb print("") printb("sabertooth <port> <left> <right>") print("Set speed of Sabertooth motor controller") print("port: /dev/ttyUSB0, /dev/ttyUSB0, /dev/ttyAMA0") print("left: Left speed from -100 to +100") print("right: Right speed from -100 to +100") print("") print("http://www.dimensionengineering.com/products/sabertooth2x25") print("NOTE! When you execute this from the command line it execute outside of steelsquid daemon, and may interrupt for example the LCD, DAC, ADC or extra GPIO.") print("It is meant to be used inside the steelsquid daemon (see http://www.steelsquid.org/steelsquid-kiss-os-development)") else: try: sab = SteelsquidSabertooth(sys.argv[1]) sab.set_dc_speed(sys.argv[2], sys.argv[3]) except KeyboardInterrupt: pass
def print_help(): ''' Print help to the screen ''' from steelsquid_utils import printb print("") printb("DESCRIPTION") print("Start and stop the Steelsquid daemon") print("Also send task events (send event to the steelsquid daemon from other task)") print("") printb("steelsquid-boot start") print("Start the deamon") print("") printb("steelsquid-boot stop") printb("steelsquid-boot shutdown") print("Stop the daemon") print("") printb("steelsquid-boot <event>") printb("event <event>") print("Broadcast event without parameters") print("") printb("steelsquid-boot <event> <parameter1> <parameter2>...") printb("event <event> <parameter1> <parameter2>...") print("Broadcast event with paramaters") print("") print("\n")
status = boolean: start or stop animation status = int: aimate for this number of seconds leav_this = Do not clear, paint this instead ''' global leav_this_on_stop leav_this_on_stop = None if type(status) == types.BooleanType: if status: animate_start(matrix_animate_wait, rotate, 0.1) else: animate_stop() else: animate_start(matrix_animate_wait, rotate, 0.1) steelsquid_utils.execute_delay(status, animate_stop) if __name__ == "__main__": if len(sys.argv) == 1: from steelsquid_utils import printb print("") printb("lmatrix test") print("Write a test") print("") else: if sys.argv[1] == 'test': matrix = [[0, 1, 1, 1, 1, 1, 1, 0], [1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 0, 1, 0, 1], [1, 0, 0, 1, 1, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1], [0, 1, 1, 1, 1, 1, 1, 0]] paint(matrix, rotate=3)
def print_help(): ''' Print help to the screen ''' from steelsquid_utils import printb print("") printb("DESCRIPTION") print("List and connect to wifi network.") print("Also import/connect to openvpn.") print("") printb("net status") print("See which access point you are connected to") print("Will also print your ip-number.") print("") printb("net enable") print("Enable networking") print("") printb("net disable") print("Enable networking") print("") printb("net list") print("List all wifi network access points") print("") printb("net connect <number>") print("Connect to open wifi network.") print("") printb("net connect <number> <password>") print("Connect to protected wifi network.") print("") printb("net vpn-openvpn <ovpn_file> <username> <password>") print("Import a .ovpn file (configure vpn)") print("") printb("net vpn-status") print("Unconfigured, Configured: <name of vpn>, Connected: <name of vpn>") print("") printb("net vpn-connect") print("Connect to vpn") print("") printb("net vpn-disconnect") print("Disconnect from vpn") print("\n")
''' steelsquid_utils.log("Pin " + str(pin) + " = " + str(status)) def xgpio_click_callback_method(pin): ''' To test the gpio event handler ''' steelsquid_utils.log("Pin " + str(pin) + " = Click") if __name__ == '__main__': import sys if len(sys.argv)==1: from steelsquid_utils import printb printb("Send commands to the Steelsquid PIIO board from the command line.") printb("This is mostly ment for test purpuse.") printb("You should use it from example kiss_expand.py running inside the steelsquid daemon.") printb("This may interupt the steelsquid daemon so for example the power off button stop working.") print("") printb("steelsquid piio") print("Is Steelsquid PIIO enable on this device.") print("") printb("steelsquid piio-on") print("Enable Steelsquid PIIO Board.") print("") printb("steelsquid piio-off") print("Disable Steelsquid PIIO Board.") print("") printb("piio shutdown") print("Shutdown and power off the system")
steelsquid_utils.log("Pin " + str(pin) + " = " + str(status)) def xgpio_click_callback_method(pin): ''' To test the gpio event handler ''' steelsquid_utils.log("Pin " + str(pin) + " = Click") if __name__ == '__main__': import sys if len(sys.argv) == 1: from steelsquid_utils import printb printb( "Send commands to the Steelsquid PIIO board from the command line." ) printb("This is mostly ment for test purpuse.") printb( "You should use it from example kiss_expand.py running inside the steelsquid daemon." ) printb( "This may interupt the steelsquid daemon so for example the power off button stop working." ) print("") printb("steelsquid piio") print("Is Steelsquid PIIO enable on this device.") print("") printb("steelsquid piio-on") print("Enable Steelsquid PIIO Board.") print("")
for c in command_string: ser.write(c) if terminate: ser.write(chr(0)) def _write_int(i): ''' Write command ''' global ser if ser == None: setup() if i > 255: ser.write(chr(255)) ser.write(chr(i - 255)) else: ser.write(chr(i)) if __name__ == "__main__": if len(sys.argv) == 1: from steelsquid_utils import printb print("") printb("digole <text>") print("Write text") print("") else: text_position(0, 0) write_text("DATA USAGE\n\r")
def print_help(): ''' Print help to the screen ''' from steelsquid_utils import printb print("") printb("DESCRIPTION") print("List and connect to wifi network.") print("Also import/connect to openvpn.") print("") printb("net status") print("See which access point you are connected to") print("Will also print your ip-number.") print("") printb("net enable") print("Enable networking") print("") printb("net disable") print("Enable networking") print("") printb("net list") print("List all wifi network access points") print("") printb("net connect <number>") print("Connect to open wifi network.") print("") printb("net connect <number> <password>") print("Connect to protected wifi network.") print("") printb("net disconnect") print("Disconnect from all network") print("") printb("net vpn-openvpn <ovpn_file> <username> <password>") print("Import a .ovpn file (configure vpn)") print("") printb("net vpn-status") print("Unconfigured, Configured: <name of vpn>, Connected: <name of vpn>") print("") printb("net vpn-connect") print("Connect to vpn") print("") printb("net vpn-disconnect") print("Disconnect from vpn") print("\n")
writeTimeout=0, dsrdtr=True) #print str(left)+"|"+str(right) def stop(self): ''' Stop this controller. ''' ser.close() if __name__ == "__main__": if len(sys.argv) == 1: from steelsquid_utils import printb print("") printb("sabertooth <port> <left> <right>") print("Set speed of Sabertooth motor controller") print("port: /dev/ttyUSB0, /dev/ttyUSB0, /dev/ttyAMA0") print("left: Left speed from -100 to +100") print("right: Right speed from -100 to +100") print("") print("http://www.dimensionengineering.com/products/sabertooth2x25") print( "NOTE! When you execute this from the command line it execute outside of steelsquid daemon, and may interrupt for example the LCD, DAC, ADC or extra GPIO." ) print( "It is meant to be used inside the steelsquid daemon (see http://www.steelsquid.org/steelsquid-kiss-os-development)" ) else: try: sab = SteelsquidSabertooth(sys.argv[1])
1 to 1825 (0 to 365 degrees) ''' position = int(position) if position < -1825 or position > 1825: raise ValueError("Must be 1 to 1825") self.ser.write('G') self.ser.write(str(position)) self.ser.write('\r') self.ser.flush() if __name__ == "__main__": if len(sys.argv)==1: from steelsquid_utils import printb print("") printb("rmcs220x speed <port> <speed>") print("Set speed of RMCS-220X High-Torque Encoder DC Servo Motor and Driver ") print("port: /dev/ttyUSB0, /dev/ttyAMA0") print("speed: -255 to +255") print("") printb("rmcs220x slow <port> <speed>") print("Set slow speed of RMCS-220X High-Torque Encoder DC Servo Motor and Driver ") print("This will rotate slow but has higher torque") print("port: /dev/ttyUSB0, /dev/ttyAMA0") print("speed: -255 to +255") print("") printb("rmcs220x position <port> <position>") print("Set position of RMCS-220X High-Torque Encoder DC Servo Motor and Driver ") print("port: /dev/ttyUSB0, /dev/ttyAMA0") print("position: 1 to 1825 (0 to 365 degrees)") print("")