Go to advanced search

by ghp
Sat Aug 03, 2019 10:22 am
Forum: Python
Topic: Running Python Scripts From A Html
Replies: 36
Views: 1753

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: 16
Views: 1934

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: 320

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: 1753

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: 1753

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: 16
Views: 1934

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: 1309

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: 664

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: 16
Views: 1934

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: 16
Views: 1934

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: 2427

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: 691

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: 691

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: 1344

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: 1344

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: 237

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...
by ghp
Thu Jul 18, 2019 9:18 pm
Forum: Python
Topic: Sending a number to raspberry pi from arduino card via USB
Replies: 7
Views: 931

Re: Sending a number to raspberry pi from arduino card via USB

print (myData) if float(myData) == 4: The number sent by the arduino is a 'int number', so try using "if int(myData) == 4". If you convert a value to a float, you loose precision and comparing gets a nightmare. What does the printout say in these cases when there are errors? If you add something li...
by ghp
Thu Jul 18, 2019 5:15 am
Forum: Python
Topic: Sending a number to raspberry pi from arduino card via USB
Replies: 7
Views: 931

Re: Sending a number to raspberry pi from arduino card via USB

Hello, look into https://pyserial.readthedocs.io/en/latest/shortintro.html, where some samples are given. Using ser.readline will not work, - ser.readline() should be used - you call this twice print(ser.readline) #missing () if ser.readline==4: #missing () better is res = ser.readline() print(res) ...
by ghp
Wed Jul 17, 2019 8:19 pm
Forum: Python
Topic: How to run this code
Replies: 3
Views: 404

Re: How to run this code

In the github readme file, there is a chapter "Installation", which covers basic installation. In 'API Reference', there is a list of dependencies. picamera, RPI.GPIO should be available on a Pi. For PIL, Pillow, there is a remark "The Pillow fork of the Python Image Library. One issue is with PIL I...
by ghp
Wed Jul 17, 2019 6:29 pm
Forum: Python
Topic: My program stuck after sometime
Replies: 17
Views: 1309

Re: My program stuck after sometime

I simulated inputs from serial in a random way. class S: def __init__(self, name, speed, timeout=0): pass def read(self): return random.choice( [b'\x01', b'\x02', b'\x03', b'\x04', b'\x05', ]) def write(self, data): print("data", data) ser=S('/dev/ttyAMA0',921600,timeout=1) This produces byte inputs...
by ghp
Mon Jul 15, 2019 7:51 pm
Forum: Python
Topic: write python output to a excel field
Replies: 3
Views: 437

Re: write python output to a excel field

by ghp
Sat Jul 13, 2019 4:59 pm
Forum: Python
Topic: LMX2594 programming using Python and Raspberry PI
Replies: 11
Views: 903

Re: LMX2594 programming using Python and Raspberry PI

You made a comment in another thread about the topic. The posted lines from you were: actually i added these lines to your code and i read back something that i did not figure out yet, i wrote Changed code and output: transferWrite( "MUXOUT", 0, 0b00000000, 0b00000100 ) transferWrite( "MUXOUT", 0, 0...
by ghp
Sat Jul 13, 2019 4:44 pm
Forum: Python
Topic: Some random error
Replies: 4
Views: 446

Re: Some random error

Yes, think MrYsLab is correct with the 'many issues'. - you did not strip down the code to the pure minimum. Not may people in this world do have exactly the same LCD, ADC, lux sensor and can run your code for validation just as provided. I used here adc_value = [math.sin(time.time()/66.666), 22.3, ...
by ghp
Fri Jul 12, 2019 5:35 pm
Forum: Python
Topic: Approach? Multiprocessing and variables
Replies: 4
Views: 516

Re: Approach? Multiprocessing and variables

What I understood: long running processes. One place where a button is checked and when pressed, then the processes run an extra second and terminate. The clue is to use Event from multiprocessing and signal the terminate! to the processes. from multiprocessing import Process, Event import time def ...
by ghp
Fri Jul 12, 2019 4:29 am
Forum: Python
Topic: LMX2594 programming using Python and Raspberry PI
Replies: 11
Views: 903

Re: LMX2594 programming using Python and Raspberry PI

perhaps needed to move this max_speed-statement after the spiLMX.open(0,0).

Go to advanced search