Go to advanced search

by rin67630
Wed Mar 27, 2019 4:20 pm
Forum: Python
Topic: pty library, how to use it?
Replies: 1
Views: 81

Re: pty library, how to use it?

Ok, I am a noob in Python and am coming from c++, but I could not find any way to use the pty library https://docs.python.org/3/library/pty.html in such a way, that minicom could read the output on a second terminal instance. I really would love to get above this hurdle. Thank you for your help. I ...
by rin67630
Tue Mar 26, 2019 7:26 pm
Forum: Python
Topic: pty library, how to use it?
Replies: 1
Views: 81

pty library, how to use it?

Since I did not get any response to my thread "Seeking for the best way to interface with another app over serial" let me try again, reformulating my question in a hopefully easier way: Ok, I am a noob in Python and am coming from c++, but I could not find any way to use the pty library https://docs...
by rin67630
Mon Mar 25, 2019 12:49 pm
Forum: Python
Topic: Looking for a small hardware device to trigger a python script on my RPi
Replies: 15
Views: 702

Re: Looking for a small hardware device to trigger a python script on my RPi

Thanks, Laszlo and Matt! I am looking for an off-the-shelf hardware button so I may give the Bluetooth remote a try first, I guess. I wonder if there may be a ready-made button product for the WEMOS D1 as well? The Wemos is an astonishing powerful device, for your need it seems overkill, albeit the...
by rin67630
Sun Mar 24, 2019 9:39 pm
Forum: Python
Topic: Looking for a small hardware device to trigger a python script on my RPi
Replies: 15
Views: 702

Re: Looking for a small hardware device to trigger a python script on my RPi

Maybe a bluetooth remote for selfies? https://www.ebay.de/itm/Selfie-Remote-Bluetooth-Ausloeser-Selbstausloeser-Drahtlose-iOS-Android-Rot/311680397966 It seems to be easy to interface, it should act as a keyboard: https://www.childs.be/blog/post/bluetooth-selfie-remote-button-mapping Viel Glück, mei...
by rin67630
Sun Mar 24, 2019 9:33 pm
Forum: Python
Topic: Seeking for the best way to interface with another app over serial.
Replies: 0
Views: 63

Seeking for the best way to interface with another app over serial.

Hi, I am currently seeking for the best way to interface with another app over serial. The other app is a blackbox that expects to get every second an incoming byte from a parametrable "serial connection" (e.g. /dev/ttyS0) At the beginning we get an initial short handshake with a control byte sent f...
by rin67630
Sun Mar 24, 2019 9:01 pm
Forum: Python
Topic: Solved: How to avoid that math problem?
Replies: 11
Views: 296

Re: Solved: How to avoid that math problem?

Thank you. That worked flawlessly. ... dB = (ret[0] + ((ret[1] & 3) * 256)) / 10 + 30 print (dB) ... You are still running the risk of problems from multiple rounding here. To avoid this rather than adding 30 after division you should add 300 before devision. OK, thank you, I will change that as we...
by rin67630
Sun Mar 24, 2019 3:01 am
Forum: Python
Topic: Solved: Formatting an integer to be passed to Serial as a single char.
Replies: 7
Views: 170

Re: Formatting an integer to be passed to Serial as a single char.

Going by the 3.5 notes: chr(i) Return the string representing a character whose Unicode code point is the integer i. For example, chr(97) returns the string 'a', while chr(8364) returns the string '€'. This is the inverse of ord(). The valid range for the argument is from 0 through 1,114,111 (0x10F...
by rin67630
Sun Mar 24, 2019 2:33 am
Forum: Python
Topic: Solved: Formatting an integer to be passed to Serial as a single char.
Replies: 7
Views: 170

Re: Formatting an integer to be passed to Serial as a single char.

danjperron wrote:
Sat Mar 23, 2019 9:40 pm
maybe
ser.write(AK.to_bytes(1,byteorder='big'))
That works!
Thank you so much.
by rin67630
Sat Mar 23, 2019 9:27 pm
Forum: Python
Topic: Solved: Formatting an integer to be passed to Serial as a single char.
Replies: 7
Views: 170

Re: Formatting an integer to be passed to Serial as a single char.

Could you use the chr() function in Python? This returns a Unicode character but for the range you are using I think you only get a single character. Yes, thanks. I tried, but got an error: Traceback (most recent call last): File "devdB.py", line 46, in <module> update() File "devdB.py", line 40, i...
by rin67630
Sat Mar 23, 2019 8:45 pm
Forum: Python
Topic: Solved: Formatting an integer to be passed to Serial as a single char.
Replies: 7
Views: 170

Solved: Formatting an integer to be passed to Serial as a single char.

I am currently struggling with the correct way to format a variable that should be passed to the Serial library in order to be issued as a single character. Here is my python3 code excerpt: import os, pty, serial import tkinter import sys import usb.core import sched, time from decimal import * from...
by rin67630
Sat Mar 23, 2019 6:39 pm
Forum: Python
Topic: Solved: How to avoid that math problem?
Replies: 11
Views: 296

Re: Solved: How to avoid that math problem?

... 3. Use division by 10 instead of multiplication by 0.1 and rearrange the calculation so that the devision is the last step of your calculation meaning things are only rounded once. I don't like this option because it's rather fragile, a seemingly innocuous change to the calculation could break ...
by rin67630
Sat Mar 23, 2019 6:32 pm
Forum: Python
Topic: Solved: How to avoid that math problem?
Replies: 11
Views: 296

Re: How to avoid that math problem?

ghp wrote:
Sat Mar 23, 2019 5:18 pm
I am not familiar with this decimal module, but possibly using decimal.Decimal(...) instead of decimal(...) could avoid the problem.
That syntax solved the error, but the results got worse. Now 2/3 of all values have plenty of decimals.
by rin67630
Sat Mar 23, 2019 4:51 pm
Forum: Python
Topic: Solved: How to avoid that math problem?
Replies: 11
Views: 296

Re: How to avoid that math problem?

It's not the math, but the fact that floating point values are represented in binary. So some values will be different than if they were represented in decimal. You can control how floating point numbers are printed using Python's format operations. For example, to display only one decimal place, y...
by rin67630
Sat Mar 23, 2019 4:22 pm
Forum: Python
Topic: Solved: How to avoid that math problem?
Replies: 11
Views: 296

Solved: How to avoid that math problem?

Hi, I have got a strange behaviour. Sometimes the math of Python3 returns a weird value, that displays badly in tkinter. #!/usr/bin/python3 # dB Meter software for Wensn # by Mikael Bendiksen (c) 2015 import os, pty, serial import decimal import tkinter import sys import usb.core import sched, time ...
by rin67630
Sun Mar 17, 2019 3:59 pm
Forum: Python
Topic: Grrr! that start with Python drives me crazy...
Replies: 6
Views: 318

Re: Start with Python gets running...

Try sudo apt install python3-usb Thank you, with your help, I got it flying under python3 now! The next challenge will be tough as well: Forwarding the dB measurement in that code to a symbolic serial port... I found that code: import os, pty, serial master, slave = pty.openpty() s_name = os.ttynam...
by rin67630
Sun Mar 17, 2019 11:28 am
Forum: Python
Topic: Grrr! that start with Python drives me crazy...
Replies: 6
Views: 318

Re: Grrr! that start with Python drives me crazy...

You appear to be attempting to run a python 2 script with Python 3. The hint is the first line #!/usr/bin/python is for python 2. To run the the scritpt as python 2 use python python script_name I tried to run using python as well. I got the error: Traceback (most recent call last): File "dB_App.py...
by rin67630
Sat Mar 16, 2019 1:40 pm
Forum: Python
Topic: Grrr! that start with Python drives me crazy...
Replies: 6
Views: 318

Grrr! that start with Python drives me crazy...

Ok, I'm a noob. I am currently trying to run a Python application that I got from Github on my Raspi 3 : https://github.com/unk1nd/dBSoftwarePy_Linux It is supposed to be an interface to an USB sound pressure level meter, written for Ubuntu. The app is scarcely documented. So I extracted dB_App.py t...
by rin67630
Sat Mar 16, 2019 2:54 am
Forum: Troubleshooting
Topic: Defective Raspi salvaged after lightning stroke...
Replies: 3
Views: 295

Re: Defective Raspi salvaged after lightning stroke...

Also...when a Pi boots, the VC4 boots first. If the VC4 was destroyed by the lightning strike it wouldn't boot at all. A number of things come to mind... I can't guarantee the causality with the stroke. I just checked my devices after it. The defect could have happened a few days before... With VC4...
by rin67630
Fri Mar 15, 2019 6:31 pm
Forum: Troubleshooting
Topic: Defective Raspi salvaged after lightning stroke...
Replies: 3
Views: 295

Defective Raspi salvaged after lightning stroke...

I have a bench of Raspis, that I use to use headless over VNC. Yesterday, we had a lightning stroke in the vicinity and one of the Raspis stopped responding to VNC calls. It continued however to send FTP messages. So I dismanteled it and checked it on my workbench. Upon booting, the activity light f...
by rin67630
Fri Mar 15, 2019 6:25 pm
Forum: Raspbian
Topic: Looking for an lean image processing on the raspi.
Replies: 1
Views: 183

Looking for an lean image processing on the raspi.

Hi folks,
I am looking after a lean image processing on the raspi. It should only resize pictures and be able to bring some text into the image.
Who can recommend such a no frills program, that runs well and fast on weak Rpi Zeros?
by rin67630
Tue Mar 12, 2019 11:52 pm
Forum: Troubleshooting
Topic: Arduino Pro Mini 8MHz 3,3V with a Raspberry Pi over GPIO RX-TX and autoreset...
Replies: 13
Views: 349

Re: Arduino Pro Mini 8MHz 3,3V with a Raspberry Pi over GPIO RX-TX and autoreset...

scruss wrote:
Tue Mar 12, 2019 11:14 pm
Yup, the SPI pins + power + reset.
SPI is already used.
by rin67630
Tue Mar 12, 2019 3:18 pm
Forum: Troubleshooting
Topic: Arduino Pro Mini 8MHz 3,3V with a Raspberry Pi over GPIO RX-TX and autoreset...
Replies: 13
Views: 349

Re: Arduino Pro Mini 8MHz 3,3V with a Raspberry Pi over GPIO RX-TX and autoreset...

scruss wrote:
Mon Mar 11, 2019 10:09 pm
There's always the ICSP connector.
Really? on a Pro Mini?
:o
by rin67630
Mon Mar 11, 2019 8:42 am
Forum: Troubleshooting
Topic: Arduino Pro Mini 8MHz 3,3V with a Raspberry Pi over GPIO RX-TX and autoreset...
Replies: 13
Views: 349

Re: Arduino Pro Mini 8MHz 3,3V with a Raspberry Pi over GPIO RX-TX and autoreset...

scruss wrote:
Sun Mar 10, 2019 5:18 pm
There may not be anything better, but the chances of this working in 2019 based on how shaky Raspberry Pi GPIO was in 2012 is slim.
Hmm... It actually works.
:D
by rin67630
Mon Mar 11, 2019 8:40 am
Forum: Troubleshooting
Topic: Arduino Pro Mini 8MHz 3,3V with a Raspberry Pi over GPIO RX-TX and autoreset...
Replies: 13
Views: 349

Re: Arduino Pro Mini 8MHz 3,3V with a Raspberry Pi over GPIO RX-TX and autoreset...

forgive me if i am missing something here but looking at the op's solution link the 'business' is just def reset(): pin = 11 GPIO.setup(pin, GPIO.OUT) GPIO.output(pin, GPIO.HIGH) time.sleep(0.12) GPIO.output(pin, GPIO.LOW) Not something you need an outdated framework to implement perhaps? You are r...
by rin67630
Mon Mar 11, 2019 8:35 am
Forum: Troubleshooting
Topic: Arduino Pro Mini 8MHz 3,3V with a Raspberry Pi over GPIO RX-TX and autoreset...
Replies: 13
Views: 349

Re: Arduino Pro Mini 8MHz 3,3V with a Raspberry Pi over GPIO RX-TX and autoreset...

An easier solution might be to use a USB-TTL adapter with a DTR line. That is precisely what I do NOT want to do. The USB-TTL adapter and the whole USB frills are way too bulky and unconvenient. Connecting a 3,3V Arduino to a 3,3V GPIO is the natural way of interconnecting two devices. You can put ...

Go to advanced search