Go to advanced search

by ricardo.santos
Thu Feb 21, 2019 2:57 pm
Forum: Python
Topic: help with threading module and passing global variables
Replies: 6
Views: 1032

Re: help with threading module and passing global variables

here you have two threads inside a class.... in that way you can use self

but if you have different threads that are not in the same class. For example between the main program and a separate thread?
by ricardo.santos
Thu Feb 21, 2019 12:17 pm
Forum: Python
Topic: help with threading module and passing global variables
Replies: 6
Views: 1032

help with threading module and passing global variables

Hi I'm having a big trouble to get this to work. I have a function that I want to put in a thread (or multiprocess). This function requires 3 variables. One of the variables (var_1) is static and no problem passing it through args in the thread module. The second variable (var_2) changes during the ...
by ricardo.santos
Fri Jan 11, 2019 3:40 pm
Forum: Graphics programming
Topic: pyqt
Replies: 1
Views: 1000

pyqt

Hi

I'm relatively new to pypt5 and some help in the direction to take is appreciated.

I want to do something like that shown in the following image

Image

Is there any already code i can reuse or some widget or so?

I would apreciate some guidance, thanks
by ricardo.santos
Fri Nov 16, 2018 3:12 pm
Forum: Automation, sensing and robotics
Topic: Buffer of ADC overflows?
Replies: 6
Views: 2069

Re: Buffer of ADC overflows?

OutoftheBOTS wrote:
Thu Nov 15, 2018 11:24 pm
I have another question!

Is there a way to know if a pin of the ADS1115 has no sensor attached?

thank you
by ricardo.santos
Fri Nov 16, 2018 10:28 am
Forum: Automation, sensing and robotics
Topic: Buffer of ADC overflows?
Replies: 6
Views: 2069

Re: Buffer of ADC overflows?

ohh thanks. That makes sense.
I will investigate that ring buffer. I don't know how to implement it.
by ricardo.santos
Thu Nov 15, 2018 6:19 pm
Forum: Automation, sensing and robotics
Topic: Buffer of ADC overflows?
Replies: 6
Views: 2069

Buffer of ADC overflows?

Hi all I'm doing a acquisition system for analog sensors (water pressures and water turbidity) using a raspberry pi 3B and a ADC (ADS1115). The problem that i am facing is that from time to time the buffer (or whatever) gets full and the ads1115 gives a zero reading. The lower the data rate (or what...
by ricardo.santos
Fri Jun 08, 2018 9:56 am
Forum: Beginners
Topic: GPIO 5v outputs 5.5v
Replies: 7
Views: 1084

Re: GPIO 5v outputs 5.5v

I've tested with an official rpi power supply and i get 5.19v from 5v pin. Is this normal?

I should not restrict it to 5v with something before connecting to sensors or micro-controllers
by ricardo.santos
Fri Jun 08, 2018 9:46 am
Forum: Beginners
Topic: GPIO 5v outputs 5.5v
Replies: 7
Views: 1084

Re: GPIO 5v outputs 5.5v

by ricardo.santos
Fri Jun 08, 2018 9:39 am
Forum: Beginners
Topic: GPIO 5v outputs 5.5v
Replies: 7
Views: 1084

GPIO 5v outputs 5.5v

Hi I've measured the 5v pin against GND pin of my RPI3B with a voltmeter and it's showing 5.45v +-0.05v. Is this normal? I'm afraid that this may damage my ADC (ADS1115) that is limited to the 5v. What should i do to limit the output to 5v? can i use a zener diode? I'm civil enginner. not very good ...
by ricardo.santos
Mon Jun 04, 2018 5:42 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: BME280 not detected via i2cdetect and heats a lot
Replies: 3
Views: 479

BME280 not detected via i2cdetect and heats a lot

Hi i'm trying to connect the BME280 (temp+hum+press) sensor to raspberry Pi3B with I2C Here is my connections https://github.com/Ricardosgeral/relier/blob/master/Fritzing/breadboard_relier.png I've connected VCC to 5V (specs say 1.8 to 5V) but i know most of people use the 3.3V. But I thought that s...
by ricardo.santos
Fri Apr 27, 2018 6:55 pm
Forum: Beginners
Topic: Run a python script when RPi is told to reboot/halt
Replies: 4
Views: 911

Re: Run a python script when RPi is told to reboot/halt

Thanks i will try it, but where do i put the python file or the bash script?
by ricardo.santos
Fri Apr 27, 2018 4:56 pm
Forum: Beginners
Topic: Run a python script when RPi is told to reboot/halt
Replies: 4
Views: 911

Run a python script when RPi is told to reboot/halt

Hi I want to run a simple python3 file (sends an instruction via serial UART) before the reboot/halt of the pi. I've tried messing with init.d rc6 and rc0 like some suggestions on the web but really nothing worked for me. I have the feeling that python may be "disconnected" before the actual script ...
by ricardo.santos
Tue Mar 27, 2018 11:35 am
Forum: Automation, sensing and robotics
Topic: Pressure sensor with inaccurate readings for zero pressure
Replies: 0
Views: 172

Pressure sensor with inaccurate readings for zero pressure

Hi I have two of these pressure sensors https://m.pt.aliexpress.com/item/1081171111.html?trace=wwwdetail2mobilesitedetail&productId=1081171111&productSubject=5PSI-Pressure-Transducer-or-Sender-for-Oil-Fuel-Air-Gas-Tank-etc I managed to connect them successfully with raspberry and ADC ads1115. The is...
by ricardo.santos
Fri Mar 16, 2018 9:20 am
Forum: Python
Topic: open txt file and get variables inside
Replies: 6
Views: 1289

Re: open txt file and get variables inside

will this work on the pi
I don't have the lib in the python3 by default
is that not specifically for ini files in windows
thanks
by ricardo.santos
Thu Mar 15, 2018 9:36 pm
Forum: Python
Topic: open txt file and get variables inside
Replies: 6
Views: 1289

open txt file and get variables inside

hi. i'm newbie in python and need some help

I have a txt file like with a structure like that below

Code: Select all

####inputs
###bla-bla-bla

xpto = 2
zzz = 10.25
name = Jonh
###

interval = 2
....

#####
How can I do in python to open the file, and get the variables as strings that have the equal sign (=)
by ricardo.santos
Sun Mar 11, 2018 9:14 am
Forum: Python
Topic: how to name a class Thread
Replies: 3
Views: 418

Re: how to name a class Thread

:idea:
so simple. thanks a lot . that works like a charm in pycharm

why the 1 inside brackets? is that needed
by ricardo.santos
Sat Mar 10, 2018 11:03 pm
Forum: Python
Topic: how to name a class Thread
Replies: 3
Views: 418

how to name a class Thread

hi i have a class using a thread as object i think how can i give it a name. it will help the debugging in pycharm temp.py class WTemp(threading.Thread): def __init__(self, sleep): threading.Thread.__init__(self) self.sleep = sleep self.W_temp = 0 def run(self): while True: # reads every sleep inter...
by ricardo.santos
Thu Mar 08, 2018 10:22 pm
Forum: Python
Topic: threading using module EVENT
Replies: 3
Views: 521

Re: threading using module EVENT

:o
thanks a lot It works now
by ricardo.santos
Thu Mar 08, 2018 5:14 pm
Forum: Python
Topic: threading using module EVENT
Replies: 3
Views: 521

Re: threading using module EVENT

the error log Exception in thread read_write: Traceback (most recent call last): File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner self.run() File "/usr/lib/python3.5/threading.py", line 862, in run self._target(*self._args, **self._kwargs) File "/home/pi/piwork/erosion-test/even...
by ricardo.santos
Thu Mar 08, 2018 4:56 pm
Forum: Python
Topic: threading using module EVENT
Replies: 3
Views: 521

threading using module EVENT

I have a code with 3 functions running as threads read() and read_write() should run alternatively (the two are never in parallel) detect() function establish which one of the two above thread functions is running and pauses the other thread I've used Event to do this import threading import numpy a...
by ricardo.santos
Mon Mar 05, 2018 9:56 am
Forum: Python
Topic: Continuasly run a function and in parallel control other functions
Replies: 7
Views: 822

Re: Continuasly run a function and in parallel control other functions

Thanks a lot OutoftheBOTS, you were very helpful

I will try to implement your advices.
by ricardo.santos
Sun Mar 04, 2018 7:43 pm
Forum: Python
Topic: Continuasly run a function and in parallel control other functions
Replies: 7
Views: 822

Re: Continuasly run a function and in parallel control other functions

I think threading is probably the best. Will you need to do both Function1() and Function2() at the same time or is it ok I 1 function waits till the other is finished?? If you don't need the 2 fuctions to run at the same time and just the serial read to run in parallel you can do this. #Have 2 glo...

Go to advanced search