{"product_id":"tri-color-usb-controlled-tower-light-with-buzzer","title":"Tri-Color USB Controlled Tower Light with Buzzer","description":"\u003cp\u003eWith this \u003cstrong\u003eTri-Color USB Controlled Tower Light with Buzzer,\u003c\/strong\u003e you can easily monitor and alert humanoids as to the status of a project, machine, or even if the bathroom is occupied!\u003c\/p\u003e\n\u003cp\u003eUnlike our other tower lights, no wiring or microcontroller programming is required. It's completely plug-and-play for use with any computer that has a USB port, even a Raspberry Pi SBC - so we recommend it when you just want to get something running and don't want to noodle around with 12V power plugs and transistors. It's also got a great adjustable-angle body and three mounting holes on the base for easy installation.\u003c\/p\u003e\n\u003cp\u003eThe tower light is powered and controlled over USB, so just plug it right in. Inside is a microcontroller connected over a CH43x USB-to-UART chip, so you'll need to install a CH43x driver for the COM\/Serial port to show up.\u003c\/p\u003e\n\u003cp\u003eOnce the serial port is created, connect to it over 9600 baud and send command codes to turn on and off the red, yellow and green LEDs and enable\/disable the buzzer. There's also a blink command, so you don't have to continuously turn on\/off the LED to have a pulsing\/blinking effect. See below for an example Python script that will toggle everything on\/off to test.\u003c\/p\u003e\n\u003ch2\u003eTechnical Details\u003c\/h2\u003e\n\u003cdiv class=\"panel-collapse collapse in\" id=\"tab-technical-details-content\"\u003e\n\u003cp\u003e\u003cstrong\u003eDimensions: \u003c\/strong\u003e\u003c\/p\u003e\n\u003cul\u003e\n\u003cli\u003eOverall length: 25.4cm \/ 10\"\u003c\/li\u003e\n\u003cli\u003eLamp diameter: 4.8cm \/ 1.8\"\u003c\/li\u003e\n\u003cli\u003eLamp base diameter: ~9cm \/ 3.5\"\u003c\/li\u003e\n\u003cli\u003eUSB cable length: 1.3m \/ ~50\"\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003cp\u003e\u003cstrong\u003ePython code example to control the lamp over USB\u003c\/strong\u003e\u003c\/p\u003e\n\u003cpre\u003e\"\"\"\nExample for Adafruit USB tower light w\/alarm\ndon't forge to `pip install pyserial` or `pip3 install pyserial`\n\"\"\"\n\nimport serial\nimport time\n\nserialPort = 'COM57' # Change to the serial\/COM port of the tower light\n#serialPort = '\/dev\/USBserial0' # on mac\/linux, it will be a \/dev path\nbaudRate = 9600\n\nRED_ON = 0x11\nRED_OFF = 0x21\nRED_BLINK = 0x41\n\nYELLOW_ON= 0x12\nYELLOW_OFF = 0x22\nYELLOW_BLINK = 0x42\n\nGREEN_ON = 0x14\nGREEN_OFF = 0x24\nGREEN_BLINK = 0x44\n\nBUZZER_ON = 0x18\nBUZZER_OFF = 0x28\nBUZZER_BLINK = 0x48\n\ndef sendCommand(serialport, cmd):\nserialport.write(bytes([cmd]))\n\nif __name__ == '__main__':\nmSerial = serial.Serial(serialPort, baudRate)\n\n# Clean up any old state\nsendCommand(mSerial, BUZZER_OFF)\nsendCommand(mSerial, RED_OFF)\nsendCommand(mSerial, YELLOW_OFF)\nsendCommand(mSerial, GREEN_OFF)\n\n# turn on each LED set in order\nsendCommand(mSerial, RED_ON)\ntime.sleep(0.5)\nsendCommand(mSerial, RED_OFF)\n\nsendCommand(mSerial, YELLOW_ON)\ntime.sleep(0.5)\nsendCommand(mSerial, YELLOW_OFF)\n\nsendCommand(mSerial, GREEN_ON)\ntime.sleep(0.5)\nsendCommand(mSerial, GREEN_OFF)\n\n# beep!\nsendCommand(mSerial, BUZZER_ON)\ntime.sleep(0.1)\nsendCommand(mSerial, BUZZER_OFF)\n\n# Use the built-in blink modes\nsendCommand(mSerial, RED_BLINK)\ntime.sleep(3)\nsendCommand(mSerial, RED_OFF)\n\nsendCommand(mSerial, YELLOW_BLINK)\ntime.sleep(3)\nsendCommand(mSerial, YELLOW_OFF)\n\nsendCommand(mSerial, GREEN_BLINK)\ntime.sleep(3)\nsendCommand(mSerial, GREEN_OFF)\n\n# Please be kind, re-wind!\nsendCommand(mSerial, BUZZER_OFF)\nsendCommand(mSerial, RED_OFF)\nsendCommand(mSerial, YELLOW_OFF)\nsendCommand(mSerial, GREEN_OFF)\nmSerial.close()\u003c\/pre\u003e\n\u003c\/div\u003e","brand":"Adafruit","offers":[{"title":"Default Title","offer_id":48624232562906,"sku":"ouk1789687349447","price":75.26,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0824\/8318\/3834\/files\/tri-color-usb-controlled-tower-light-with-buzzer_1.jpg?v=1789687380","url":"https:\/\/memoryfoamwear.shop\/products\/tri-color-usb-controlled-tower-light-with-buzzer","provider":"My Store","version":"1.0","type":"link"}