Go to advanced search

by MrYsLab
Thu Aug 08, 2019 2:13 pm
Forum: Python
Topic: How to using a value from spinbox
Replies: 3
Views: 151

Re: How to using a value from spinbox

The value returned from spinbox is a string. To convert the string to an integer use int(). For example if the value returned is "4", and stored in a variable called x to convert :

Code: Select all

value = int(x)
by MrYsLab
Wed Aug 07, 2019 4:20 pm
Forum: Python
Topic: How to using a value from spinbox
Replies: 4
Views: 206

Re: How to using a value from spinbox

In general, one of the main reasons to use a class is that allows one to avoid using globals and organizes the code so that it is easier to read and debug. Therefore, I have reformatted your script as follows. It should now function properly. from tkinter import * import tkinter as tk import time cl...
by MrYsLab
Tue Aug 06, 2019 9:57 pm
Forum: Python
Topic: Pygame event type
Replies: 2
Views: 138

Re: Pygame event type

In the future, please use code tags to maintain formatting. I am not sure this is what you tried to post or not, but the code definitely had some issues. import pygame pygame.init() continuer = True while continuer: for event in pygame.event.get(): if event.type == pygame.QUIT: continuer = False pyg...
by MrYsLab
Mon Aug 05, 2019 4:31 pm
Forum: Python
Topic: Main Window Disappears When I Use A "while" Command
Replies: 11
Views: 350

Re: Main Window Disappears When I Use A "while" Command

I highly doubt your issue has anything to do with garbage collection. GUI libraries typically operate using an event loop that assumes it owns the processor. If you introduce a While loop into your application, this will block the GUI event loop from running. You need to coordinate your loop with th...
by MrYsLab
Sun Aug 04, 2019 11:57 pm
Forum: Python
Topic: RPI4 - Python Editor Mu crashing on start
Replies: 3
Views: 181

Re: RPI4 - Python Editor Mu crashing on start

I am running mu on Buster on a Pi4 4gb and it runs right out of the box with no issue for me. Perhaps you need to try from a clean install of Buster?
I have apt-get updated and apt-get ugpraded before trying mu.
by MrYsLab
Sun Aug 04, 2019 11:51 pm
Forum: Python
Topic: Old-school GUI - Possible? (Beware, silly purpose)
Replies: 27
Views: 4010

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

I was going to recommend that you use guizero instead of tkinter (guizero is built on top of tkinter), but Andyroo's suggestion is a good one. I took a quick look and the course is using guizero. If you have the time, the course will probably give you all that you need, plus you can get some help if...
by MrYsLab
Sun Aug 04, 2019 11:18 pm
Forum: Python
Topic: How to use Pyserial on raspberry pi
Replies: 6
Views: 304

Re: How to use Pyserial on raspberry pi

@sid I assume you are referring to this article attributed to Douglas6 https://www.reddit.com/r/raspberry_pi/comments/6nchaj/guide_how_to_establish_bluetooth_serial/ If you were successful in pairing the 2 Pis, and you are allowed to use socket communications instead of serial (I think sockets are s...
by MrYsLab
Sun Aug 04, 2019 8:23 pm
Forum: Python
Topic: How to use Pyserial on raspberry pi
Replies: 6
Views: 304

Re: How to use Pyserial on raspberry pi

Here is a link to a tutorial on how to physically connect 2 Pis. https://scribles.net/setting-up-uart-serial-communication-between-raspberry-pis/ Once you have communication running between the 2 Pis, you then need to come up with a messaging protocol between the 2. Here is a link to a tutorial on c...
by MrYsLab
Sun Aug 04, 2019 8:13 pm
Forum: Python
Topic: RPi 3B+ with ADS1115 limited sampling rate issue
Replies: 3
Views: 178

Re: RPi 3B+ with ADS1115 limited sampling rate issue

Your best bet IMHO, would be to either create an issue for the Adafruit library https://github.com/adafruit/Adafruit_Ci ... on_ADS1x15 or seek some help on the Adafruit forum site https://forums.adafruit.com/.
by MrYsLab
Thu Aug 01, 2019 4:42 pm
Forum: Python
Topic: Can i take while loop in thread ?
Replies: 2
Views: 496

Re: Can i take while loop in thread ?

They are different. Are you trying to have your program wait for a period of time while other processing occurs during the wait time? If that is the case, that is exactly what a thread will allow you to do. Here is a simple example using Python3 where I have one timer running in the main thread and ...
by MrYsLab
Tue Jul 30, 2019 3:16 pm
Forum: Python
Topic: Arduino does not recieve value from raspberry pi
Replies: 8
Views: 413

Re: Arduino does not recieve value from raspberry pi

Try:

Code: Select all

s1.write(bytes([ord(data)]))
by MrYsLab
Mon Jul 29, 2019 7:49 pm
Forum: Python
Topic: Issue with Pyserial module extracting device serial number
Replies: 13
Views: 2261

Re: Issue with Pyserial module extracting device serial number

I am not sure if this is what you mean, but I tried plugging an Arduino Uno and Arduino Leonardo in different orders and into different USB ports. Whichever Arduino I plugin first, gets assigned a port /dev/ttyACM0 and the second get assigned /dev/ttyACM1. No matter which I plug in first or which US...
by MrYsLab
Mon Jul 29, 2019 4:41 pm
Forum: Python
Topic: Issue with Pyserial module extracting device serial number
Replies: 13
Views: 2261

Re: Issue with Pyserial module extracting device serial number

I don't have the same interface you do, but if I plug 2 arduino's in here are the results I see. The command I used is: python3 -m serial.tools.list_ports -v or for windows: python -m serial.tools.list_ports -v You can also access the serial tools programmatically : https://pyserial.readthedocs.io/e...
by MrYsLab
Wed Jul 24, 2019 9:09 pm
Forum: Python
Topic: Neopixel tkinter and RPI. Infinity loop braker
Replies: 1
Views: 138

Re: Neopixel tkinter and RPI. Infinity loop braker

Since you are using a class, no globals are necessary. Just declare the variables inside of __init__. In fact, you can eliminate all the global code between the imports and the class definition and place it in __init__. The methods that are outside of the class can be placed within the class. You ma...
by MrYsLab
Sat Jul 20, 2019 12:47 pm
Forum: Python
Topic: Run a asyncio socket function a a thread
Replies: 21
Views: 1390

Re: Run a asyncio socket function a a thread

* An array of 6 esp32's. This should not be an issue * One acting as accesspoint This should not be an issue * 1 rpi3 running a large app in tkinter. Not sure of your architecture, but Banyan is easily integrated with tkinter * mqtt broker on pi Python Banyan does not use MQTT, but does provide a si...
by MrYsLab
Fri Jul 19, 2019 11:52 pm
Forum: Python
Topic: Run a asyncio socket function a a thread
Replies: 21
Views: 1390

Re: Run a asyncio socket function a a thread

I forgot you were looking for esp32 support. I would just need to port my esp8266 micropython code to the esp32. Do you need anything beyond simple digital I/O?
by MrYsLab
Fri Jul 19, 2019 7:04 pm
Forum: Python
Topic: Run a asyncio socket function a a thread
Replies: 21
Views: 1390

Re: Run a asyncio socket function a a thread

You probably should create an issue on GitHub.

If you want to give Python Banyan a stab, let me know, and I could walk you through it. I know for a fact that it works since it was thoroughly tested.
by MrYsLab
Sat Jul 13, 2019 6:26 pm
Forum: Python
Topic: Subprocessing? Calling and terminating a python script from another python script
Replies: 6
Views: 540

Re: Subprocessing? Calling and terminating a python script from another python script

Again, I am not really sure what the code is supposed to do, but a possible solution is to replace the raise statements with continue to go to the next iteration of the loop: if (routineStatus == 1) and (deviceTriggerLocation == deviceLocation): if componentsid == 5 and routineAction == 1: proc1 = s...
by MrYsLab
Sat Jul 13, 2019 5:47 pm
Forum: Python
Topic: Subprocessing? Calling and terminating a python script from another python script
Replies: 6
Views: 540

Re: Subprocessing? Calling and terminating a python script from another python script

It is a little difficult to understand what the coding is actually doing, but I modified it so that proc1 is initialized to None at the top of the loop and to throw an exception if proc1 is None when a kill is called. This should at least point out where the issue is and you can correct from there: ...
by MrYsLab
Sat Jul 13, 2019 2:06 pm
Forum: Python
Topic: Some random error
Replies: 4
Views: 302

Re: Some random error

I think your code structure has lots of issues. I converted your code (untested) to a single class and hopefully this will help you get things going. import openpyxl # read, write excel Sheet import time # import time from system from RPLCD import CharLCD # Configure LCD import RPi.GPIO as GPIO # Co...
by MrYsLab
Thu Jul 11, 2019 2:08 pm
Forum: Python
Topic: BME280 and pigpio python3.7 extentse Name error
Replies: 5
Views: 348

Re: BME280 and pigpio python3.7 extentse Name error

Did you install Python 3.7 yourself or are you using the Buster version of Raspbian? If you did your own install, you may want to burn a new sd card with Buster and try that.
by MrYsLab
Thu Jul 11, 2019 2:00 pm
Forum: Python
Topic: pysftp install fails
Replies: 2
Views: 303

Re: pysftp install fails

The error is caused because the compile can't find Python.h.

To install Python .h, type:

Code: Select all

sudo apt-get install python-dev
If you decide to move to Python3, the command would be:

Code: Select all

sudo apt-get install python3-dev
by MrYsLab
Tue Jul 09, 2019 3:46 pm
Forum: Python
Topic: LMX2594 programming using Python and Raspberry PI
Replies: 11
Views: 546

Re: LMX2594 programming using Python and Raspberry PI

You might want to check out the examples on the pigpio python examples page: http://abyz.me.uk/rpi/pigpio/examples.h ... hon%20code
Although not specific to the LMX2594, there are several SPI examples and perhaps they may give you some ideas.

Go to advanced search