Go to advanced search

by ghp
Mon Sep 09, 2019 7:14 pm
Forum: Scratch
Topic: Raspberry Pi 4 and Scratch 2
Replies: 3
Views: 173

Re: Raspberry Pi 4 and Scratch 2

Hello, had similiar problems here. Happens here on pi4, scratch2 both when uploading file for a sprite or stage background 'backdrop'. Selection menu opens, pi seems to be frozen in the menu. A ssh-connection to the pi is still working. "top" shows low cpu usage. "killall electron" stops scratch2. E...
by ghp
Sat Aug 31, 2019 5:04 am
Forum: Python
Topic: Help understanding 74HC595
Replies: 3
Views: 170

Re: Help understanding 74HC595

Calling clear() at the beginning of the operations, just after setup(), is needed. This avoids problems by GPIO having unknown state because program is stopped and restarted with again calling setup(). I would propose to change the code a bit. Instead of the block def inputBits(dat): for bit in rang...
by ghp
Sun Aug 25, 2019 8:04 pm
Forum: Python
Topic: ADS1115 I2C audio with python
Replies: 2
Views: 110

Re: ADS1115 I2C audio with python

The ADS1115 is a high precision device but rather slow: "programmable Data Rate:8 SPS to 860 SPS". This means that 430Hz are highest frequency resolvable. Cited from https://physics.stackexchange.com/questions/76463/what-is-the-meaning-of-frequency-of-a-human-voice: "According to the Wikipedia artic...
by ghp
Fri Aug 23, 2019 7:00 am
Forum: Deutsch
Topic: Schwingungsmessung bzw. Zeitwaage
Replies: 3
Views: 1055

Re: Schwingungsmessung bzw. Zeitwaage

Vielleicht wäre noch eine Echtzeituhr von nöten ? Wenn mal der Strom ausfällt und der Pi rebootet, dann ist die Zeit weg. Oder ggf. ein GPS Empfänger als Uhr-Ersatz. Die Erfassung der Pendelperiode sollte einigermassen genau sein ? Was sind da die Anforderungen ? 1 sekunde aufs Jahr würde bedeuten, ...
by ghp
Fri Aug 23, 2019 6:27 am
Forum: Python
Topic: Read IR Remote scancodes (no LIRC) from Waveshare ir sensor
Replies: 3
Views: 163

Re: Read IR Remote scancodes (no LIRC) from Waveshare ir sensor

Hello, your getkey method is matching the NEC code timings. Found a description for NEC here: https://exploreembedded.com/wiki/NEC_IR_Remote_Control_Interface_with_8051 To compare with RC5: https://en.wikipedia.org/wiki/RC-5 Your decoding logic could be improved: your code grabs logic levels and jus...
by ghp
Thu Aug 22, 2019 3:10 pm
Forum: Python
Topic: problem read analog value LDR sensor for raspberry pi
Replies: 4
Views: 179

Re: problem read analog value LDR sensor for raspberry pi

There are quite a lot of different LDR available. The first datasheet I found says: 20 kΩ Light, 5k bright light, 20MΩ dark Capacitors unfortunatley have a leakage current, which is low for tantalum types and higher for aluminium types. tantalum for 1uF is about 0.5uA, the aluminium have something a...
by ghp
Wed Aug 21, 2019 2:14 pm
Forum: Scratch
Topic: scratch3 performance comparison
Replies: 1
Views: 342

scratch3 performance comparison

Had a walk through cambridge today and found first and only raspberry pi shop. Bought a pi4, 4gb. Installed scratch3, network is nice and fast here in hotel. Did a few performance tests (using VNC connection), using scratch3 and scatch1.4 - for two sprites, rotate 1 degree, for 10 sec. scratch 3: 30...
by ghp
Sat Aug 17, 2019 5:47 pm
Forum: Python
Topic: Quckest Bootable OS For Python Scripts ?
Replies: 3
Views: 1437

Re: Quckest Bootable OS For Python Scripts ?

for starting a program at startup, see
https://www.dexterindustries.com/howto/ ... t-startup/

Your script "its ascript which when a input is pressed it triggers a gpio " needs console input, or gpio input ?
If only GPIO is needed, use systemd to start.
by ghp
Sat Aug 17, 2019 5:40 pm
Forum: Python
Topic: No data written in CSV file
Replies: 8
Views: 1540

Re: No data written in CSV file

change the code a bit and ensure file is closed after each write. while True: with open("humidity.csv", "a+") as log: ... read sensor value ... d = "{0},{1}\n".format(strftime("%Y-%m-%d %H:%M:%S"),str(humidity)) print(d) log.write(d) sleep(1) The "a+" is 'append or create if not available'.
by ghp
Fri Aug 16, 2019 6:08 pm
Forum: Python
Topic: How to separate the body of the email in Gmail (like 1 email 1 body)?
Replies: 5
Views: 1715

Re: How to separate the body of the email in Gmail (like 1 email 1 body)?

Hello, the problem with the growing text could be that the mail object is build in main code once, and in sending the mail some text is attached each time. mail = MIMEMultipart() mail['From'] = fromaddr mail['To'] = toaddr mail['Subject'] = "[Intruder Alert] Motion Detected!" body = "Who is the Intr...
by ghp
Mon Aug 12, 2019 7:59 pm
Forum: Python
Topic: reading a online database but have a fall over on the pi ?
Replies: 7
Views: 1572

Re: reading a online database but have a fall over on the pi ?

https://stackoverflow.com/questions/139 ... d-the-cont

Surround this with a try:...except Exception: and read the file in the exception branch.
by ghp
Mon Aug 12, 2019 4:57 pm
Forum: Python
Topic: GPIO Input doesn't work
Replies: 8
Views: 1200

Re: GPIO Input doesn't work

Ups, my fault. Think here is a good reference ?
https://elinux.org/RPi_Low-level_peripherals#P1_Header
by ghp
Mon Aug 12, 2019 4:45 pm
Forum: Python
Topic: GPIO Input doesn't work
Replies: 8
Views: 1200

Re: GPIO Input doesn't work

See https://raspberrypi.stackexchange.com/questions/12966/what-is-the-difference-between-board-and-bcm-for-gpio-pin-numbering BCM 1 is on pin 28 of the header and not available on the 'old' PI generations. There is also a graphical tool like https://pinout.xyz/# BCM 17, 27, 22. 23. 24 are a good cho...
by ghp
Sun Aug 11, 2019 12:38 pm
Forum: Python
Topic: Old-school GUI - Possible? (Beware, silly purpose)
Replies: 25
Views: 3525

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

svg is handy to produce lines, blocks, text. svg can be included in html. <html><body><svg>...elements...</svg></body></html> In tornado, the Handler methods can produce svg on the fly, using Elementtree and then convert to string and paste into the html. Assume a set of methods which build labels, ...
by ghp
Sat Aug 10, 2019 3:45 pm
Forum: Python
Topic: My python program respond responding very slow as time goes on
Replies: 14
Views: 1438

Re: My python program respond responding very slow as time goes on

Could you give some details about the solution found ?
by ghp
Sat Aug 10, 2019 3:21 pm
Forum: Python
Topic: Old-school GUI - Possible? (Beware, silly purpose)
Replies: 25
Views: 3525

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

still looking for technologies or solutions ?
Screenshot_2019-08-10.png
Screenshot_2019-08-10.png (4.42 KiB) Viewed 2301 times
produced in html, using embedded svg. The generating code is python in tornado simulating block graphics. The input field is embedded html input field.
by ghp
Sat Aug 10, 2019 8:27 am
Forum: Python
Topic: For some reason my code presses random buttons
Replies: 3
Views: 194

Re: For some reason my code presses random buttons

Did not know the "webbrowser" module so far. Nice module. Sending ctrl-w to this browser only works when the browser has the focus. Whenever it is in background, the keyboard event will not arrive. This resulted in additional tabs opened in some cases. Here on my pi, the webbrowser.open calls 'epiph...
by ghp
Sat Aug 10, 2019 7:49 am
Forum: Python
Topic: Running Python Scripts From A Html
Replies: 36
Views: 929

Re: Running Python Scripts From A Html

Think tornado can't achieve to change a web page in a browser after some seconds. ** This requirement needs javascript in the page. Found https://www.tutorialspoint.com/How-to-use-JavaScript-to-redirect-a-webpage-after-5-seconds The code snippet from there is <!DOCTYPE html> <html> <body> <script> s...
by ghp
Thu Aug 08, 2019 4:41 pm
Forum: Python
Topic: Running Python Scripts From A Html
Replies: 36
Views: 929

Re: Running Python Scripts From A Html

StaticFileHandler is a good choice for the start page.
If you need images or css files, add appropriate url-pathes too.
by ghp
Wed Aug 07, 2019 5:12 pm
Forum: Python
Topic: Running Python Scripts From A Html
Replies: 36
Views: 929

Re: Running Python Scripts From A Html

Think the two scripts opendoor_1.py, opendoor_2.py are not available in local directory. Either rename the scripts you have to these names, or adjust the calls in the Handlers. The code fragment is Python3ScriptRunner().invoke( "opendoor_1.py") or Python3ScriptRunner().invoke( "opendoor_2.py"). In m...
by ghp
Tue Aug 06, 2019 8:05 pm
Forum: Python
Topic: Running Python Scripts From A Html
Replies: 36
Views: 929

Re: Running Python Scripts From A Html

think this could work import tornado.ioloop import tornado.web import subprocess import os class Python3ScriptRunner: def __init__(self): pass def invoke(self, script_name): print("call script ", script_name) if os.path.isfile(script_name): pid = subprocess.Popen(["/usr/bin/python3", script_name]).p...
by ghp
Mon Aug 05, 2019 5:05 am
Forum: Python
Topic: Old-school GUI - Possible? (Beware, silly purpose)
Replies: 25
Views: 3525

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

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

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

Go to advanced search