Go to advanced search

by Adaulith
Wed Oct 17, 2018 12:51 am
Forum: Python
Topic: Waiting for progress bar
Replies: 2
Views: 400

Re: Waiting for progress bar

Awesome! I got it to work thanks. Definitely bookmarking that page, wish it would have shown up in my google searches. It was pretty easy here is what I did to get it to work. I had to make a QEventLoop object in my pHCalibrationScreen class, after the progress bar class is called the QEventLoop sta...
by Adaulith
Mon Oct 15, 2018 10:33 pm
Forum: Python
Topic: Waiting for progress bar
Replies: 2
Views: 400

Waiting for progress bar

I am trying to create a calibration GUI for my Atlas Scientific pH probe for a program that I am working on. What I am trying to do is have it so a screen pops up where you can enter 3 values for calibration. to make it easy here lets say the 3 values are 4,7,10. There is then a button that says cal...
by Adaulith
Sun Mar 25, 2018 12:19 am
Forum: Python
Topic: getting values from variable and storing it to array
Replies: 14
Views: 1474

Re: getting values from variable and storing it to array

Do you want just the last average of 10 values? Or to log all of the average of 10 values?
Do you want to be able to pull up the last average on the start of a new script?

Do you want the program to give an error if the sensor is >0.5volts, or just not accept the data?
by Adaulith
Thu Mar 22, 2018 2:38 pm
Forum: Python
Topic: getting values from variable and storing it to array
Replies: 14
Views: 1474

Re: getting values from variable and storing it to array

import spidev import numpy as np GPIO.setmode(GPIO.BOARD) GPIO.setwarnings(False) GPIO.setup(11, GPIO.OUT) spi = spidev.SpiDev() spi.max_speed_hz = 250000 def poll_sensor(channel): assert 0 <= channel <= 1 if channel: cbyte=0b11000000 else: cbyte=0b10000000 r = spi.xfer2([1,cbyte,0]) return ((r[1]&...
by Adaulith
Tue Mar 20, 2018 3:06 pm
Forum: Python
Topic: getting values from variable and storing it to array
Replies: 14
Views: 1474

Re: getting values from variable and storing it to array

Here is something I put together. It should do what you need. I still made it an object but simplified it. Here is the object to store and average the data. class averageData: def __init__(self, x, y, z ): self.maxPoints = x #Sets the maximum number for the array self.varList = [] #Initialize the li...
by Adaulith
Tue Mar 20, 2018 1:30 pm
Forum: Python
Topic: getting values from variable and storing it to array
Replies: 14
Views: 1474

Re: getting values from variable and storing it to array

@adaulita Nice useful object. Just out of neatness would it be slightly better to store the time stamp with the data in a 2 dimensional array. Something like this [ [time, data], [time, data], [time, data], [time,data], [time, data], [time, data], [time, data], [time,data] ] Thanks, You're right it...
by Adaulith
Tue Mar 20, 2018 1:09 am
Forum: Python
Topic: getting values from variable and storing it to array
Replies: 14
Views: 1474

Re: getting values from variable and storing it to array

I've made a class that looks like will also work for what you need. I use it for my live streaming graph for sensor inputs. import datetime class graph_data: def __init__(self, x, y): self.max_points = x # the max amount of points to store in the list. Defined in the setpoints for each sensor self.g...
by Adaulith
Tue Jan 23, 2018 4:18 pm
Forum: Python
Topic: Multithreading guidiance
Replies: 12
Views: 1324

Re: Multithreading guidiance

So, I was able to implement it into my actual program and got it working. I did have to modify some of the code however and have a question as to as why. Trying to get a grasp as to what is going on. def main(): app = QApplication(sys.argv) temp_probe = temperature_i2c(102,1) temp_probe.start() temp...
by Adaulith
Mon Jan 22, 2018 5:43 pm
Forum: Python
Topic: Multithreading guidiance
Replies: 12
Views: 1324

Re: Multithreading guidiance

This works!
Thank you very much for your help!

It has also given me a better understanding of what is going on. You've helped me solve a major problem with this project that I am designing :D
by Adaulith
Mon Jan 22, 2018 4:36 pm
Forum: Python
Topic: Multithreading guidiance
Replies: 12
Views: 1324

Re: Multithreading guidiance

Thanks for the response. I have added what you have suggested, and am still getting some errors. Sorry for the previous code. I cleaned it up a bit this time. Hopefully it's a bit better. import sys, fcntl, io, time, threading from time import sleep from PyQt5.QtWidgets import QMainWindow, QAction, ...
by Adaulith
Sat Jan 20, 2018 4:04 pm
Forum: Python
Topic: Multithreading guidiance
Replies: 12
Views: 1324

Re: Multithreading guidiance

Well I started to put together some code. I took just a skeleton portion of it , to try and get it working from the rest of my program. The code I post runs, but it doesn't do what I want it to do. The GUI still 'hangs' for the 1.5 seconds that it sleeps (the long_timeout variable) in the temp_probe...
by Adaulith
Fri Jan 19, 2018 9:07 pm
Forum: Python
Topic: Multithreading guidiance
Replies: 12
Views: 1324

Re: Multithreading guidiance

I am far from a expert on threading in fact I tend to take experts opinion and try avoid using threading because of all the potintial problems it opens up. First I would ask why is it taking so long to read the sensors if your using i2C the RPi is the master device it sets the clock speed for coms ...
by Adaulith
Fri Jan 19, 2018 8:07 pm
Forum: Python
Topic: Multithreading guidiance
Replies: 12
Views: 1324

Re: Multithreading guidiance

You could thread each sensor if it takes time to get a result and just leave them running in the background. Just ask for it's value and get whatever was the last variable update for it was. I cannot see a need to stop them when using the pumps, just don't call them for their value if it would mess...
by Adaulith
Fri Jan 19, 2018 4:46 pm
Forum: Python
Topic: Multithreading guidiance
Replies: 12
Views: 1324

Re: Multithreading guidiance

Thanks,

I guess I mean by the UI thread I mean just the "thread" that is created when I create the script - maybe not the correct terminology?
by Adaulith
Fri Jan 19, 2018 3:58 pm
Forum: Python
Topic: Multithreading guidiance
Replies: 12
Views: 1324

Multithreading guidiance

Just wanted to pick at all your smart peoples brains to see if I'm on the right track here. After some delay I'm back working on a project. Basically it's a batch reactor with some sensor inputs. The sensors inputs are - Dissolved oxygen (DO) https://www.atlas-scientific.com/dissolved-oxygen.html - ...
by Adaulith
Fri Oct 20, 2017 2:33 pm
Forum: General programming discussion
Topic: Guidance on language for GUI Python or ??
Replies: 5
Views: 1572

Re: Guidance on language for GUI Python or ??

Thanks for the replies. I should clarify on the "real time", Every 10 seconds or so I would like to plot a data point. I would hope that would make things easy. I log the sensor data to a file right now, but I do it in averages of over 5 minutes (depending on the sensor) otherwise it's too much data...
by Adaulith
Thu Oct 19, 2017 9:01 pm
Forum: General programming discussion
Topic: Guidance on language for GUI Python or ??
Replies: 5
Views: 1572

Guidance on language for GUI Python or ??

New to this whole Raspberry pi business and I could use some guidance. I am attempting to redo a project that I did with an Arduino. It worked, but it was clunky and the GUI interface was poor (it was on a 3.5" TFT Screen). My question is what language do you think would be best to program this in? ...

Go to advanced search