Go to advanced search

by ghp
Mon Jan 06, 2020 10:40 am
Forum: Python
Topic: installing latest meld
Replies: 4
Views: 405

Re: installing latest meld

There is a development page in the meld home page
https://meldmerge.org/development.html
According to these descriptions, this should be simple. I tried it here (get from git, run python code) but found various problems with the availability of supporting libraries.
by ghp
Mon Jan 06, 2020 10:25 am
Forum: Python
Topic: Digital reading of GPIO inputs from ADC converter /Digital osciloscope
Replies: 5
Views: 444

Re: Digital reading of GPIO inputs from ADC converter /Digital osciloscope

There is another post about an oscilloscope. https://www.raspberrypi.org/forums/viewtopic.php?f=32&t=259535 The author reports 1500 samples per second. Which is good for python, but pretty slow compared to the 32MSPS which are possible with the AD converter on the board. cited from https://ez.analog...
by ghp
Mon Jan 06, 2020 9:43 am
Forum: Python
Topic: How to Upgrade Raspbian OS 4.14 to 4.19 via terminal
Replies: 5
Views: 267

Re: How to Upgrade Raspbian OS 4.14 to 4.19 via terminal

See https://docs.python-guide.org/scenarios/admin/ for a description of various software to remote admin computers. ansible is quite interesting, as it requires no agent to be installed on remote machine. When executing apt-tasks, add a '-y' option so the tools does not ask for confirmations. There ...
by ghp
Sun Jan 05, 2020 6:46 pm
Forum: Python
Topic: Using gpiozero with tkinter
Replies: 3
Views: 249

Re: Using gpiozero with tkinter

Possibly the problem is that the LED objects are created, but then deleted when methods are left. To check this, create all LED objects and keep them alive. For this, I propose to create a class which keeps the objects. Could look like the following. Could not test this so far. import tkinter as tk ...
by ghp
Sat Jan 04, 2020 8:49 am
Forum: Python
Topic: GPIO Zero: How to Increment Servo to Initial Angle instead of Max Angle.
Replies: 1
Views: 161

Re: GPIO Zero: How to Increment Servo to Initial Angle instead of Max Angle.

Assuming you use the AngularServo-class from gpio-zero, you could try something like wanted_angleNS = servoNS.angle + 1 # depends what you mean by 'middle angle'. # could be something like # -- zero value # -- arithmethic middle # middle_angle = 0 middle_angle = (servoNS.max_angle + servoNS.min_angl...
by ghp
Fri Jan 03, 2020 10:57 am
Forum: Python
Topic: Help with escaping python 3.8.1
Replies: 1
Views: 262

Re: Help with escaping python 3.8.1

Most possibly you have added a call to python somewhere in .bash-files for local user 'pi'.
Type 'quit()' into the command line and the python interpreter exits. Then correct the wrong commands.
by ghp
Fri Jan 03, 2020 7:48 am
Forum: Python
Topic: td6600 driver and nema 17 stepper RPM
Replies: 2
Views: 309

Re: td6600 driver and nema 17 stepper RPM

Hello, there are some discussions in other posts, e.g. https://www.raspberrypi.org/forums/viewtopic.php?t=242928 If you drive the motor with 1/32 microsteps, and 50 RPM, 200 steps per revolution, then you need 32 * 50 * 200 pulses in 60 secs. Which is 5333Hz, quite fast for python code. If you use a...
by ghp
Thu Jan 02, 2020 9:54 am
Forum: Python
Topic: Running a function from outside the script
Replies: 6
Views: 392

Re: Running a function from outside the script

You can periodically re-read the file in the script. So when the file changes, after some time the labels/colors change. tkinter provides a timer mechanism: def ledsUpdate(self): # Check remote switches status and show in leds # do the work here... # add a periodic call to this method root.after( 50...
by ghp
Tue Dec 31, 2019 8:01 am
Forum: Python
Topic: How to synchronize data on txt files between raspberrys
Replies: 16
Views: 760

Re: How to synchronize data on txt files between raspberrys

Did you remove the sudo from

Code: Select all

subprocess.call("sudo scp ...
??
by ghp
Mon Dec 30, 2019 7:11 pm
Forum: Python
Topic: How to synchronize data on txt files between raspberrys
Replies: 16
Views: 760

Re: How to synchronize data on txt files between raspberrys

Let me again propose a MQTT solution for distributing switch state: Taken from http://www.steves-internet-guide.com/into-mqtt-python-client/ Sending (publish) state of a switch to the broker: import paho.mqtt.client as mqtt #import the client1 broker_address="192.168.1.184" # this is the one compute...
by ghp
Mon Dec 30, 2019 5:44 pm
Forum: Python
Topic: How to synchronize data on txt files between raspberrys
Replies: 16
Views: 760

Re: How to synchronize data on txt files between raspberrys

to avoid asking for a password you could give the password on command line: subprocess.call("sshpass -p REMOTEPASSWORD scp /home/pi/Pi1-flags.txt [email protected].168.1.38:/home/pi/", shell=True) use "sudo apt-get install sshpass" once to install sshpass. You should probably add "-o StrictHostKeyChecking=no" ...
by ghp
Mon Dec 30, 2019 12:39 pm
Forum: Python
Topic: multiple i2c sensores
Replies: 5
Views: 514

Re: multiple i2c sensores

Hello, I used two MCP23017 port expander which use I2C to validate your setup. config.txt: dtoverlay=i2c-gpio,bus=3,i2c_gpio_delay_us=1,i2c_gpio_sda=17,i2c_gpio_scl=27 this results (after reboot) to have additional i2c device available: ls /dev/i2c* /dev/i2c-1 /dev/i2c-3 And with the commands (subst...
by ghp
Sun Dec 29, 2019 6:20 pm
Forum: Python
Topic: no module named MCP23S17
Replies: 3
Views: 309

Re: no module named MCP23S17

There is the 'first line' in a python file which is like #!/usr/bin/env python3 which at least gives an idea what the author thought about which interpreter to be used. It is still possible to start the files with different version of python, which will in some cases fail as syntax and other details...
by ghp
Sun Dec 29, 2019 4:23 pm
Forum: Python
Topic: Charlieplexing buttons gives additional outputs
Replies: 3
Views: 283

Re: Charlieplexing buttons gives additional outputs

It is clear that closing S1 and S2 connects P2, P3 which results in these additional results.
One solution could be to add diodes in series with each switch and remove D1 to D4. Needs 8 additional diodes...
by ghp
Fri Dec 27, 2019 9:16 am
Forum: Python
Topic: How to synchronize data on txt files between raspberrys
Replies: 16
Views: 760

Re: How to synchronize data on txt files between raspberrys

Sharing files between computers can be done using samba shares. https://pimylifeup.com/raspberry-pi-samba/ In the shared subfolder, a file can be created and shared. There might by problems when one computers writes to a file while the other wants to read it. Inconsistent information could be read. ...
by ghp
Thu Dec 26, 2019 6:05 am
Forum: Python
Topic: How can the servo rotate continuously?
Replies: 3
Views: 267

Re: How can the servo rotate continuously?

Code: Select all

c++ is p+=1
c-- is p-=1
by ghp
Thu Dec 26, 2019 12:03 am
Forum: Python
Topic: How can the servo rotate continuously?
Replies: 3
Views: 267

Re: How can the servo rotate continuously?

The context of your question is unclear.
"tracker01" seems to be an instance of a class. What class is this, which library is used, what type of servo is used and how is it connected to the arduino ?
by ghp
Wed Dec 25, 2019 8:15 pm
Forum: Python
Topic: Serial Monitor for Python
Replies: 2
Views: 286

Re: Serial Monitor for Python

Look for https://pythonhosted.org/pyserial/ which allows to handle serial communication.
by ghp
Tue Dec 24, 2019 1:42 pm
Forum: Python
Topic: Help for programming
Replies: 3
Views: 288

Re: Help for programming

MQTT allows for 'subscription'. A client can register for a 'topic', and when topic gets updated by someone the client gets a message. Pretty flexible. Personally I prefer to use c,c++ with arduino for the esp code. But micropython should be possible too. Look whether your LEDs need special librarie...
by ghp
Tue Dec 24, 2019 8:37 am
Forum: Python
Topic: Help for programming
Replies: 3
Views: 288

Re: Help for programming

It is possible. From a zillion of possible approaches, let me propose a MQTT-based way. MQTT https://en.wikipedia.org/wiki/MQTT is simple to set up, well documented and there are good libraries to work with. - setup your pi with a fixed IP address. As it will be the MQTT server, it is essential to d...
by ghp
Sat Dec 21, 2019 1:05 pm
Forum: Python
Topic: Python help for thermostat program
Replies: 4
Views: 543

Re: Python help for thermostat program

#Main section! def thermostat(): print("Bypass beginning of THERMOSTAT:",bypassFlag) # shortened print("END") master.after(3000,thermostat) #repeat this section ! That is how tkinter works ! print("function terminates") In tkinter, you tell tkinter code to call the function 'thermostat' after 3000 ...
by ghp
Sun Dec 15, 2019 9:38 am
Forum: Python
Topic: Python help for thermostat program
Replies: 4
Views: 543

Re: Python help for thermostat program

Hello, mainloop is where tkinter processes it's events. Your approach of running the 'thermostat' in a function and periodically call it in a 'master.after(3000,thermostat)' is correct. tkinter programs work this way. The variable "bypassFlag" or "boilerStatus" seem to have a 'global scope' . You sh...
by ghp
Sun Dec 01, 2019 9:08 am
Forum: Python
Topic: MCP3204 does not give any lecture of temp measurements with lm35, it worked before i actualized
Replies: 1
Views: 159

Re: MCP3204 does not give any lecture of temp measurements with lm35, it worked before i actualized

Difficult to follow your code as the indendation is lost. See https://www.raspberrypi.org/forums/view ... 32&t=84477
What did you change ? "it worked before i actualized".
by ghp
Mon Nov 18, 2019 8:23 pm
Forum: Python
Topic: How to get LED's to turn off immediately?
Replies: 1
Views: 211

Re: How to get LED's to turn off immediately?

Without the use of threads, there is no very simple implementation. Here a proposal to use something like a time-slot-solution. In a loop, time ticks are propagated to a LED class which keeps start- and end times. As the loop runs quite fast a button press almost immediately stops the loop. The code...

Go to advanced search