Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

188
Views
Communicating over serial Port in HTML/PHP with Python

I have an device connected over "/dev/ttyUSB0" to my RaspberryPi. In Chromium I want to set it on "Remote" with a python-serial script:

import serial
ser = serial.Serial()
ser.baudrate = 9600
ser.port = "/dev/ttyUSB0"
ser.open()
ser.write("REM".encode("utf-8"))
ser.close()

this executes on a HTML ButtonClick Event compared with some js code:

function goPython() {
  $.ajax({
    url: "serial.py",
    context: document.body
  }).done(function) {
    alert('finished python script');;
  });
}

HTML:

<head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
</head>
<body>
    <button id="click" onclick="goPython()">GO!</button>
</body>

It runs on my Chromium Browser at the RasPi and says:

finished python script

But the device, sadly isnt in Remote Access. Anybody got a hint? Since I had very positive experiences at StackOverflow I wanted to post it here. Thanks a lot people!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!