Go to advanced search

by MrYsLab
Tue Jan 22, 2019 9:15 pm
Forum: Python
Topic: driver Weewx for BYOWS
Replies: 8
Views: 679

Re: driver Weewx for BYOWS

Does your driver work at all? If not, post your code using Code tags and explain the issues you are having. In addition, what specific hardware are you using? I have not used Weewx, but may be able to help if you provide some details. If there are others who are experienced Weewx users, hopefully, t...
by MrYsLab
Tue Jan 22, 2019 9:07 pm
Forum: Python
Topic: H2 receive and act upon images send by email to my RPi email account
Replies: 4
Views: 295

Re: H2 receive and act upon images send by email to my RPi email account

This recent article about sending email using Python might help you to get started: https://realpython.com/python-send-email/.
by MrYsLab
Mon Jan 21, 2019 2:24 pm
Forum: Python
Topic: Need help programming pwm motor control with xbox 360 controller as input
Replies: 1
Views: 117

Re: Need help programming pwm motor control with xbox 360 controller as input

You may be importing the wrong xbox library. You might want to investigate this library: https://github.com/linusg/xbox360controller
by MrYsLab
Mon Jan 21, 2019 2:17 pm
Forum: Python
Topic: Learn Python 2 or 3 and how?
Replies: 15
Views: 800

Re: Learn Python 2 or 3 and how?

I agree with JessieRPi's comments. When you say that programming Python on the RPi is niche, I don't know if I would agree with that. It depends upon what you are trying to do. If you are trying to control and monitor GPIO pins, there are some very fine Python libraries, such as PIGPIO that make it ...
by MrYsLab
Fri Jan 18, 2019 3:50 pm
Forum: Python
Topic: Move servo, play sound and light LED on button press
Replies: 9
Views: 607

Re: Move servo, play sound and light LED on button press

Have you tried either of these Gpiozero interfaces? https://gpiozero.readthedocs.io/en/stab ... html#servo or https://gpiozero.readthedocs.io/en/stab ... gularservo.

They provide nice high-level abstractions for controlling servos.
by MrYsLab
Fri Jan 18, 2019 2:18 pm
Forum: Python
Topic: interrupt a function when value changed from gpio with i2c communication
Replies: 1
Views: 158

Re: interrupt a function when value changed from gpio with i2c communication

You have given very little information making it difficult to answer your question. If you are writing a program that just wants to compare the current analog value with some preset value, then in the loop where you read the analog value, test for the desired value with an "if" statement. If your pr...
by MrYsLab
Wed Jan 16, 2019 5:54 pm
Forum: Troubleshooting
Topic: Trying to upgrade to Stretch
Replies: 6
Views: 269

Re: Trying to upgrade to Stretch

I too, run headless, but I don't use VNC but xrdp. I find VNC to be slow and visually rather ugly. The xrdp package does not have any licensing issues and works well with my Ubuntu 18.10 pc, and also with Windows. You can load xrdp and it no longer interferes with VNC. All you need to do is to remem...
by MrYsLab
Wed Jan 16, 2019 4:35 pm
Forum: Troubleshooting
Topic: Trying to upgrade to Stretch
Replies: 6
Views: 269

Re: Trying to upgrade to Stretch

I have never been able to be completely successful in attempts to upgrade Jessie to Stretch and found it a lot less time consuming to just save the files I created on Jessie and replacing them into a fresh Stretch install. That being said, did you first do a "sudo apt-get update", then the upgrade? ...
by MrYsLab
Wed Jan 16, 2019 1:12 pm
Forum: Python
Topic: python tcp client script help
Replies: 9
Views: 748

Re: python tcp client script help

Your concept seems sound, but I have not tried your scripts to know if the code is complete. If you look at either of the articles that I have pointed to, you should be able to get things up and running quickly. In the second article, it sends a message once and closes. As I mentioned earlier, remov...
by MrYsLab
Tue Jan 15, 2019 2:42 pm
Forum: Python
Topic: wxwidgets and python 3.
Replies: 1
Views: 453

Re: wxwidgets and python 3.

Have you tried following these instructions: https://wiki.wxpython.org/BuildWxPythonOnRaspberryPi
by MrYsLab
Tue Jan 15, 2019 1:34 pm
Forum: Python
Topic: python tcp client script help
Replies: 9
Views: 748

Re: python tcp client script help

Here is another link https://wiki.python.org/moin/TcpCommunication that shows both sides of the connection. You will need to add a while loop and remove the close() to keep both sides running continuously.
by MrYsLab
Mon Jan 14, 2019 4:21 pm
Forum: Python
Topic: python tcp client script help
Replies: 9
Views: 748

Re: python tcp client script help

You should be able to adapt an echo client/server to meet your needs. Here is a link that may get you going:
https://pymotw.com/3/socket/tcp.html
by MrYsLab
Tue Jan 08, 2019 2:32 pm
Forum: Python
Topic: Guizero HX711 Load Cell and python3
Replies: 2
Views: 513

Re: Guizero HX711 Load Cell and python3

What I believe you are trying to do is combine your "while True" loop with the event loop of Guizero. To do that, you will need to use the tkinter ".after" method. Here is a link to an article about using .after: https://stackoverflow.com/questions/44085554/how-to-use-the-after-method-to-make-a-call...
by MrYsLab
Mon Jan 07, 2019 12:59 pm
Forum: Python
Topic: How to add checkbox
Replies: 10
Views: 434

Re: How to add checkbox

There are many concepts that one has to learn to be an effective tkinter programmer. There are many online tutorials and videos. Here are 2: http://zetcode.com/gui/tkinter/ and https://www.python-course.eu/python_tkinter.php . There is an excellent library, guizero https://lawsie.github.io/guizero/a...
by MrYsLab
Sun Jan 06, 2019 8:11 pm
Forum: Python
Topic: How to add checkbox
Replies: 10
Views: 434

Re: How to add checkbox

I am not sure I understand your question. If you are looking to add a checkbox to your GUI, there is a tutorial here: https://www.delftstack.com/tutorial/tki ... eckbutton/
by MrYsLab
Thu Jan 03, 2019 6:10 pm
Forum: Python
Topic: Help with Python code for IR obstacle sensor on a Rover
Replies: 3
Views: 265

Re: Help with Python code for IR obstacle sensor on a Rover

If you place a print statement after the readkey:

Code: Select all

try:
    while True:
        keyp = readkey()
        print(keyp)
 
If you only see the output when a key is pressed it is blocking.
by MrYsLab
Wed Jan 02, 2019 2:07 pm
Forum: Python
Topic: TCP IP connection
Replies: 7
Views: 543

Re: TCP IP connection

Typically, one creates a separate receive thread to handle incoming tcp data. Since tcp is only a transport for the raw bytes, it is up to your program to gather and interpret them according to the design of your print server. That could be anythng from binary protocol, to an ascii type protocol - i...
by MrYsLab
Tue Jan 01, 2019 3:55 pm
Forum: Python
Topic: TCP IP connection
Replies: 7
Views: 543

Re: TCP IP connection

If you are able to connect to the server, then you are correct, you only need to write the client side.
by MrYsLab
Mon Dec 31, 2018 9:05 pm
Forum: Python
Topic: Help with Python code for IR obstacle sensor on a Rover
Replies: 3
Views: 265

Re: Help with Python code for IR obstacle sensor on a Rover

In the code: # main loop try: while True: keyp = readkey() is readkey blocking until a key is pressed or does it return something if no key is pressed? If it is blocking , you will probably need to add a separate thread to monitor the IR sensors and to control the motors. Since the main loop control...
by MrYsLab
Sun Dec 30, 2018 4:11 pm
Forum: Python
Topic: TCP IP connection
Replies: 7
Views: 543

Re: TCP IP connection

You do need to provide 2 sides to complete a TCP connection, - the "connect" side and the "bind" side. Perhaps I am misunderstanding how your application works. Do you have something that already provides the "bind" side? If not, you will need to write and run both the connect and bind scripts, one ...
by MrYsLab
Sun Dec 30, 2018 2:42 pm
Forum: Python
Topic: Python Questions - py2exe?
Replies: 6
Views: 1935

Re: Python Questions - py2exe?

You are correct. Since the op does not provide a rationale for wanting the .exe, I offer this as a possible solution.
It all depends upon the project's requirements.
by MrYsLab
Sun Dec 30, 2018 2:12 pm
Forum: Python
Topic: Python Questions - py2exe?
Replies: 6
Views: 1935

Re: Python Questions - py2exe?

If having your users install your program using Python setup tools or pip is acceptable to you, you can configure setup.py specifying "Entry Points". This will install the program as a native (Windows, macOS, Linux) executable that will be available on the command line for the user. Here is a link t...
by MrYsLab
Sun Dec 30, 2018 2:02 pm
Forum: Python
Topic: TCP IP connection
Replies: 7
Views: 543

Re: TCP IP connection

It appears that you have implemented only one side of the connection. Take a look at this article https://pymotw.com/3/socket/tcp.html that addresses implementing a Python TCP client and server and see if that answers your question.
by MrYsLab
Sat Dec 29, 2018 7:39 pm
Forum: Python
Topic: How to compare current and next day
Replies: 27
Views: 1143

Re: How to compare current and next day

Here is a fully working example, including TK that uses a python class, no threads and no globals. from tkinter import * import RPi.GPIO as GPIO import datetime class DisplayAndClear: def __init__(self): INPUT_PIN=11 # change to 21 for your hardware setup self.now = datetime.datetime.now() self.last...
by MrYsLab
Sat Dec 29, 2018 2:18 pm
Forum: Python
Topic: How to compare current and next day
Replies: 27
Views: 1143

Re: How to compare current and next day

You might want to consider using a class. It simplifies the whole global variable mess caused when using Python as a procedural language. Classes, IMHO are far simpler to deal with than globals.

Go to advanced search