#!/usr/bin/python
# 2009-05-03-09:00 SRJ
#
# This little circuit can be built into a
# DB9 shell and used as a go/no signal on
# an otherwise headless machine, it can
# be turned on or off by any user in the
# dialout group. A 3 lead Bi-Color LED
# will also be able to show yellow.
# Resistors are about 1.5K (Bn Gn Or)
# Pin-(Sig) Resistor LED
# Red~
# 7-(RTS)---/\/\/\/----|>|--+
# |
# 5-(GND)-------------------+
# |
# 4-(DTR)---/\/\/\/----|>|--+
# Grn~
#
# Bring in the seriel library that lets us set signals.
import serial
# Create the object that points to the physical hardware.
# Set /dev/ttyUSB0 if needed.
s=serial.Serial('/dev/ttyS0')
# Use the library calls with our object to provide
# voltage in the range -12V to +12V to specific
# pins of the seriel port.
# RTS and DTR are inverted so 0 is +12V or on.
# Red
# s.setRTS(0)
# s.setDTR(1)
# Green
# s.setRTS(1)
# s.setDTR(0)
# Yellow
# s.setRTS(0)
# s.setDTR(0)
# Off
s.setRTS(1)
s.setDTR(1) |
#!/usr/bin/python
# 2009-05-03-09:00 SRJ
#
# This little circuit can be built into a
# DB9 shell and used as a go/no signal on
# an otherwise headless machine, it can
# be turned on or off by any user in the
# dialout group. A 3 lead Bi-Color LED
# will also be able to show yellow.
# Resistors are about 1.5K (Bn Gn Or)
# Pin-(Sig) Resistor LED
# Red~
# 7-(RTS)---/\/\/\/----|>|--+
# |
# 5-(GND)-------------------+
# |
# 4-(DTR)---/\/\/\/----|>|--+
# Grn~
#
# Bring in the seriel library that lets us set signals.
import serial
# Create the object that points to the physical hardware.
# Set /dev/ttyUSB0 if needed.
s=serial.Serial('/dev/ttyS0')
# Use the library calls with our object to provide
# voltage in the range -12V to +12V to specific
# pins of the seriel port.
# RTS and DTR are inverted so 0 is +12V or on.
# Red
# s.setRTS(0)
# s.setDTR(1)
# Green
# s.setRTS(1)
# s.setDTR(0)
# Yellow
# s.setRTS(0)
# s.setDTR(0)
# Off
s.setRTS(1)
s.setDTR(1)