N_Albar
November 10, 2018, 1:51am
1
Hi,
I am working on a project with Philips lights, and I am trying to run this script
import serial, requests
#replace this with your serial device.
# ser = serial.Serial('/dev/tty.usbmodemfd141', 9600)
ser = serial.Serial('/dev/tty.usbmodemfd131', 9600)
#ser = serial.Serial('/dev/tty.usbserial-A800I2RW', 9600)
siteStartChar = 0x04
siteEndChar = 0x05
postStartChar = 0x06
postEndChar = 0x07
dataStartChar = 0x08
dataEndChar = 0x03
postData = ""
postRequest = ""
site = ""
def readValue(endChar):
tmp = ""
while 1:
val = ser.read()
if ord(val) == endChar:
This file has been truncated. show original
It asks to
" #replace this with your serial device.
ser = serial.Serial('/dev/tty.usbmodemfd141', 9600)"
where can I find the "serial device" / "serial.Serial" ?
MorganS
November 10, 2018, 2:05am
2
That's a Python program. You might get better help on a Python forum.
"dev/tty" is a Linux thing. You might get better help on a Linux forum.
pert
November 10, 2018, 3:57am
3
You could find it in the Arduino IDE's Tools > Port menu. Just replace the /dev/tty.usbmodemfd141 with whatever it shows on that menu for your Arduino board, but if there's a board name in quotes, leave that off. For example, if you see in your Tools > Port menu: COM2 (Arduino/Genuino Uno), then you should do this:
ser = serial.Serial('COM2', 9600)"
https://pyserial.readthedocs.io/en/latest/shortintro.html