Go to advanced search

by MrYsLab
Sun Aug 04, 2019 8:13 pm
Forum: Python
Topic: RPi 3B+ with ADS1115 limited sampling rate issue
Replies: 3
Views: 338

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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.
by MrYsLab
Tue Jul 09, 2019 3:41 pm
Forum: Python
Topic: DHT22 script error handling
Replies: 2
Views: 374

Re: DHT22 script error handling

How about adding a try/except block as shown below. For the degree symbol - that is easy: degree_sign= u'\N{DEGREE SIGN}' temp = 34.5 print(str(temp) + degree_sign) ~ Try/except block added to your code: ##!/usr/bin/python # -*- coding: utf-8 -*- import time import Adafruit_DHT DHT_SENSOR = Adafruit...
by MrYsLab
Sun Jul 07, 2019 2:40 pm
Forum: Python
Topic: tkinter and GPIO, how to set up a physical input button
Replies: 8
Views: 1679

Re: tkinter and GPIO, how to set up a physical input button

Wow! You are doing a lot of research. I don't have a lot of experience in this realm, but found a posting that may be of some help:
https://www.raspberrypi.org/forums/view ... p?t=205523

You may also want to look at something like this sensor: https://www.adafruit.com/product/2168
by MrYsLab
Fri Jul 05, 2019 1:06 pm
Forum: Python
Topic: label with textvariable doesn't refresh (tkinter)
Replies: 4
Views: 773

Re: label with textvariable doesn't refresh (tkinter)

I modified your code to just run the tkinter elements and it seems to work without issue.
If you print out the value of InputValue in your getValue function after the readline, what do you get?
by MrYsLab
Mon Jul 01, 2019 11:53 am
Forum: Python
Topic: Doing multiple jobs at the same time
Replies: 3
Views: 478

Re: Doing multiple jobs at the same time

To run the loops concurrently, one solution is to use threading. Here is a great article with working examples: https://pymotw.com/3/threading/ . Your GUI would be the main thread and in its initialization method would spawn and start separate threads for the other 2 loops before starting its own ma...
by MrYsLab
Sun Jun 30, 2019 2:49 pm
Forum: Python
Topic: tkinter and GPIO, how to set up a physical input button
Replies: 8
Views: 1679

Re: tkinter and GPIO, how to set up a physical input button

I believe the book you are using, uses the RPi.GPIO library. If I am correct then, RPi.GPIO has a very similar construct to pigpio and instead of callback, they use different terminology and call it interrupt . You may read about it here - just scroll down the page to find the section on interrupts:...
by MrYsLab
Sat Jun 29, 2019 10:57 am
Forum: Python
Topic: Run a asyncio socket function a a thread
Replies: 21
Views: 2635

Re: Run a asyncio socket function a a thread

The previous poster is partially correct. It is true, there is no native implementation of ZMQ for MicroPython. Banyan provides a MircoPython script that runs on the ESP and it communicates with a Banyan component called the ESP gateway over TCP/IP. The gateway publishes the information on the Banya...
by MrYsLab
Fri Jun 28, 2019 10:50 pm
Forum: Python
Topic: Restart Race-timer script
Replies: 1
Views: 268

Re: Restart Race-timer script

I am not sure why you are comparing the input values to >0.5 since an input value will be either a 0 or a 1. Not that the would not work, it's just that for digital input values one would not expect to see a floating point number. Below is some code (untested) that may meet your needs. I moved the i...
by MrYsLab
Fri Jun 28, 2019 10:16 pm
Forum: Python
Topic: tkinter and GPIO, how to set up a physical input button
Replies: 8
Views: 1679

Re: tkinter and GPIO, how to set up a physical input button

Below is a small tkinter program that converts feet to meters. It also includes code to set a pin as a GPIO input (connected to a pushbutton) and another connected to an LED. Anytime the pushbutton is pressed it will light the LED and when it is released, it will turn off the LED. It uses the pigpio...
by MrYsLab
Fri Jun 28, 2019 11:55 am
Forum: Python
Topic: Run a asyncio socket function a a thread
Replies: 21
Views: 2635

Re: Run a asyncio socket function a a thread

You may want to look at python-banyan https://mryslab.github.io/python_banyan/# It is being used by Palace Games and there is an article on the RPi blog that mentions it https://www.raspberrypi.org/blog/raspberry-pi-escape-room/ Banyan requires neither threading or asyncio since it provides concurre...

Go to advanced search