Go to advanced search

by ghp
Mon Aug 05, 2019 5:05 am
Forum: Python
Topic: Old-school GUI - Possible? (Beware, silly purpose)
Replies: 27
Views: 3759

Re: Old-school GUI - Possible? (Beware, silly purpose)

Block graphics can be build with "curses", a python library. But the large font for the 'company name' is possibly not supported.
by ghp
Mon Aug 05, 2019 4:35 am
Forum: Python
Topic: Running Python Scripts From A Html
Replies: 36
Views: 954

Re: Running Python Scripts From A Html

- the last line of code is missing tornado.ioloop.IOLoop.current().start() - html code usually has links inside <body>... here goes the page ...</body>. Your page works unexpectedly. - in the Popen, add ", shell=True". Or try using /usr/bin/python which is more precise. - the url mappings contain r"...
by ghp
Sun Aug 04, 2019 5:33 pm
Forum: Python
Topic: problem connect epsolar-tracer to raspberry pi
Replies: 15
Views: 511

Re: problem connect epsolar-tracer to raspberry pi

The cable has an USB device build in, but unfortunately I can't find more information for this vendor-product. Found a page which provides a driver for this sort of devices https://github.com/kasbert/epsolar-tracer/tree/master/xr_usb_serial_common-1a And someone who wired the device directly. https:...
by ghp
Sun Aug 04, 2019 11:29 am
Forum: Python
Topic: Running Python Scripts From A Html
Replies: 36
Views: 954

Re: Running Python Scripts From A Html

Brackets come in pairs.
by ghp
Sun Aug 04, 2019 10:14 am
Forum: Python
Topic: Problem with my OLED time, date, weather script.
Replies: 6
Views: 353

Re: Problem with my OLED time, date, weather script.

Code: Select all

    data = json.loads(response.read())
    print("data from response is", data)  # add this statement and look what the data structure is
    temp = data['main']['temp']
by ghp
Sun Aug 04, 2019 8:30 am
Forum: Python
Topic: Running Python Scripts From A Html
Replies: 36
Views: 954

Re: Running Python Scripts From A Html

how would it be possible to open a .html file i have already created when the "Release Door" link is pressed? Static files can be handled with (drum fill) StaticFileHandler. return tornado.web.Application([ ( r"/", MyFormHandler ), ( r"/myform", MyFormHandler ), ( r"/sample", MySampleHandler ), ( r...
by ghp
Sat Aug 03, 2019 4:55 pm
Forum: Python
Topic: Running Python Scripts From A Html
Replies: 36
Views: 954

Re: Running Python Scripts From A Html

The link in the html page <a href="/sample">a sample link</a> is using url "/sample". The url resolution table in the code ( r"/", MyFormHandler), ( r"/myform", MyFormHandler), ( r"/sample", MySampleHandler), links /sample to MySampleHandler. You know about http-requests: a link is a using a GET-req...
by ghp
Sat Aug 03, 2019 4:03 pm
Forum: Python
Topic: Running Python Scripts From A Html
Replies: 36
Views: 954

Re: Running Python Scripts From A Html

Hello, this handler MyFormHandler with its post method is dedicated to the form in the html. Think you spotted the url mapping to the handlers in the code ( r"/", MyFormHandler), ( r"/myform", MyFormHandler), ( r"/sample", MySampleHandler), The method names correspond to the GET, POST, ... request n...
by ghp
Sat Aug 03, 2019 11:03 am
Forum: Python
Topic: Running Python Scripts From A Html
Replies: 36
Views: 954

Re: Running Python Scripts From A Html

Hello, in the Handler for the link, add import subprocess Good if the python script executes fast. subprocess.run("python3 test1.py", shell=True) For long running scripts, you should spawn the process. pid = subprocess.Popen(["python3", "test1.py"]).pid print(pid) # pid allows to terminate the proce...
by ghp
Sat Aug 03, 2019 10:22 am
Forum: Python
Topic: Running Python Scripts From A Html
Replies: 36
Views: 954

Re: Running Python Scripts From A Html

unfortunately there is the python2-python3 confusion.
For python3, install and run with

# recommended, as Tornado 6.0 requires Python 3.5.2
sudo pip3 install tornado
python3 tornado1.py
by ghp
Sat Aug 03, 2019 7:01 am
Forum: Python
Topic: problem connect epsolar-tracer to raspberry pi
Replies: 15
Views: 511

Re: problem connect epsolar-tracer to raspberry pi

Hello, the /dev/ttyACM0 is available on my system too. With 'lsusb', you find out some more details about vendorid, productid of usb devices. Here the partial output on a system with an arduino uno and a common FTDI chip Bus 001 Device 006: ID 0403:6001 Future Technology Devices International, Ltd F...
by ghp
Fri Aug 02, 2019 7:26 pm
Forum: Python
Topic: Pass and Fail counter with GPIO and tkinter
Replies: 3
Views: 147

Re: Pass and Fail counter with GPIO and tkinter

Hmm, and where is the problem ?
by ghp
Fri Aug 02, 2019 6:24 pm
Forum: Python
Topic: Running Python Scripts From A Html
Replies: 36
Views: 954

Re: Running Python Scripts From A Html

Tornado basic example is here. a form, a link. Run the code, use browser and localhost:8888 should bring up the sample page. import tornado.ioloop import tornado.web class MainHandler(tornado.web.RequestHandler): def get(self): self.write('<a href="%s">link to story 1</a>' % self.reverse_url("story"...
by ghp
Fri Aug 02, 2019 5:18 pm
Forum: Python
Topic: Running Python Scripts From A Html
Replies: 36
Views: 954

Re: Running Python Scripts From A Html

Look for a python based 'web server' like tornado (my favorite), flask, django. Then your web requests are directly handled inside a python environment.
If you want the html page to be public, then security issues might need a more complicated architecture.
by ghp
Fri Aug 02, 2019 5:01 pm
Forum: Python
Topic: problem connect epsolar-tracer to raspberry pi
Replies: 15
Views: 511

Re: problem connect epsolar-tracer to raspberry pi

Hmm, nice looking cable. Assume in windows device manager, Serial connections, there is a 'COM'-device visible. On pi, unplug cable, wait a few secs, then do a " ls /dev/tty* ". Plug in cable, wait few secs, and do again " ls /dev/tty* ". Differences ? If no differences, the cable has no appropriate...
by ghp
Fri Aug 02, 2019 4:45 pm
Forum: Python
Topic: My program stuck after sometime
Replies: 17
Views: 889

Re: My program stuck after sometime

print(""" I proposed to use if rbuff[0]-2 <= temp <= rbuff[0]+2: which is a "interval comparison", see 5.9. Comparisons in https://docs.python.org/2/reference/expressions.html instead of (the user is active with same code and different names here): https://www.raspberrypi.org/forums/viewtopic.php?f...
by ghp
Fri Aug 02, 2019 4:10 pm
Forum: Python
Topic: error saving adafruit ADS 1115 input to .csv through RPi 3B+
Replies: 10
Views: 444

Re: error saving adafruit ADS 1115 input to .csv through RPi 3B+

Hello, python - what a surprise - is no ultrafast application. But with a certain idea where performance bottlenecks are there can be major improvements. File open-close is slow . Opening a file, writing few data and close is slow. Better to open file once, write all data and close when program term...
by ghp
Fri Aug 02, 2019 3:20 pm
Forum: Python
Topic: problem connect epsolar-tracer to raspberry pi
Replies: 15
Views: 511

Re: problem connect epsolar-tracer to raspberry pi

Can't access this link, there seems to be a password needed. If you can connect to windows, then it is most possibly USB based. The USB serial adapter in Linux usually are named /dev/ttyUSB0. Connect the device and in a terminal, check command ls /dev/ttyUSB* . Then in your code change /dev/ttyACM0 ...
by ghp
Thu Aug 01, 2019 5:26 pm
Forum: Python
Topic: problem connect epsolar-tracer to raspberry pi
Replies: 15
Views: 511

Re: problem connect epsolar-tracer to raspberry pi

There are various options listed how to connect this device. How do you connect ?
Found https://www.epsolarpv.com/upload/cert/f ... L-V1.0.pdf, page 22. Or is there a better documentation available ?
by ghp
Thu Aug 01, 2019 4:50 am
Forum: Python
Topic: Need help with Python Library T6713 CO2 Sensor - I2C
Replies: 6
Views: 2118

Re: Need help with Python Library T6713 CO2 Sensor - I2C

Check with raspi-config that I2C is enabled.
When enabled, use 'ls /dev/i2c*' in a terminal to check if the device is available.
I2C should be independent from baud rate settings ? What did you change exactly in config.txt ?
by ghp
Thu Aug 01, 2019 4:45 am
Forum: Python
Topic: Arduino does not recieve value from raspberry pi
Replies: 8
Views: 388

Re: Arduino does not recieve value from raspberry pi

The photo shows that you use two serial adapters in parallel, - a usb to digital from the raspberry - the usb cable, most possibly to a pc or laptop. Take a look to the schematics https://content.arduino.cc/assets/UNO-TH_Rev3e_sch.pdf. Both of these inputs go into (TXD)PD1, (RXD)PD0 pins of the proc...
by ghp
Tue Jul 30, 2019 5:46 pm
Forum: Python
Topic: Arduino does not recieve value from raspberry pi
Replies: 8
Views: 388

Re: Arduino does not recieve value from raspberry pi

Hello, your code is z= str(cx)+'a' s1.write(z.enocde()) What is the range of cx ? Please add z= str(cx)+'a' print ("z is", z) s1.write(z.enocde()) and give some of the results here. I assume that the byte arrays transferred are something like b"123.4a". Your arduino code has some problems. (A1) You ...
by ghp
Sun Jul 28, 2019 6:01 pm
Forum: Python
Topic: trying to import RPi.GPIO in module
Replies: 21
Views: 672

Re: trying to import RPi.GPIO in module

think "the problem" is the pwm-variable def setPwm(self): gpio.setup(self.boardPin, gpio.OUT) r = gpio.PWM(self.boardPin, 50) r.start(2) return ("good") When the method terminates, the r-variable is destroyed and PWM terminates. To vaIidate this, I added a time.sleep(10) after the r.start() and got ...
by ghp
Sat Jul 27, 2019 3:02 pm
Forum: Python
Topic: trying to import RPi.GPIO in module
Replies: 21
Views: 672

Re: trying to import RPi.GPIO in module

Hello, when you say "the code below does not do anything", I assume there are no error messages. Did you try to print the result of the d.setPwm()-method like print( dd.setPwm()) just to be sure that this method is called ? If you use a basic servo, the valid pulse with are 1 to 2 ms in the 20 ms fr...
by ghp
Thu Jul 25, 2019 7:11 pm
Forum: Python
Topic: Getting unexpected error while using oled...
Replies: 2
Views: 135

Re: Getting unexpected error while using oled...

You do not give too much information. What is the exact error message, where are the variables defined you are using. What did you already do to correct the problem? Are there other places where it works? For the library, there is example code, e.g. https://github.com/adafruit/Adafruit_Python_SSD130...

Go to advanced search