Go to advanced search

by ricardo.santos
Sun Mar 04, 2018 10:36 am
Forum: Python
Topic: Continuasly run a function and in parallel control other functions
Replies: 7
Views: 850

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

That's great thanks
What if I want to pause Function1() while is running and flag becomes false
It's not doing that know right.?
Is there a way to put the function like in a queue and pause or stop then if the flags become false?
by ricardo.santos
Sat Mar 03, 2018 8:46 pm
Forum: Python
Topic: Continuasly run a function and in parallel control other functions
Replies: 7
Views: 850

Continuasly run a function and in parallel control other functions

Hi I need to built a pythonfile.py that starts to do a task (monitor at all time a serial port) And when a certain condition is true(receive a certain byte in serial) start/stop certain functions that I already have. But is important that the task of reading the serial port is always running and nev...
by ricardo.santos
Fri Mar 02, 2018 2:32 pm
Forum: Python
Topic: I need a bite in the bytes :)
Replies: 4
Views: 785

Re: I need a bite in the bytes :)

ok thanks

one more thing

if i have

a='x02'

how can i make

b='\x02'

if i do
b="\"+ a
i have an error SyntaxError: EOL while scanning string literal

if i do
b="\\"+a
print(b)
b='\\x02'

which has \\ insted of \
by ricardo.santos
Fri Mar 02, 2018 10:27 am
Forum: Python
Topic: I need a bite in the bytes :)
Replies: 4
Views: 785

I need a bite in the bytes :)

Hi, I'm not a programing guy and i have some difficulty doing something that i imagine is very simple for most of you I have some bytes (encode as latin-1) like b'f\x01\xff\xff\xff' b'p308.95\xff\xff\xff' In the first one I only want the x01 and get the numeric representation as integer in the secon...
by ricardo.santos
Wed Feb 28, 2018 4:17 pm
Forum: Python
Topic: nextion HMI device - write to serial in python
Replies: 0
Views: 846

nextion HMI device - write to serial in python

Hi I want to send through the serial port on rpi the command to the nextion device p[2].b[3].txt=”hi”ÿÿÿ I have this python code ___________________________ import serial ser = serial.Serial(port=’/dev/ttyAMA0′,baudrate=9600,parity=serial.PARITY_NONE,stopbits=serial.STOPBITS_ONE,bytesize=serial.EIGH...
by ricardo.santos
Mon Feb 05, 2018 10:09 am
Forum: Automation, sensing and robotics
Topic: water temp sensor - sleep() does not work as intended!!
Replies: 12
Views: 1427

Re: water temp sensor - sleep() does not work as intended!!

thank you all for the suggestions.
I've some ideas to work with thanks
by ricardo.santos
Fri Feb 02, 2018 5:43 pm
Forum: Automation, sensing and robotics
Topic: water temp sensor - sleep() does not work as intended!!
Replies: 12
Views: 1427

Re: water temp sensor - sleep() does not work as intended!!

do you know a low budget sensor that reads water temp faster?
by ricardo.santos
Fri Feb 02, 2018 5:32 pm
Forum: Automation, sensing and robotics
Topic: water temp sensor - sleep() does not work as intended!!
Replies: 12
Views: 1427

water temp sensor - sleep() does not work as intended!!

Hi friends I have a water temp sensor DS18B20 (https://www.adafruit.com/product/381) It's connected to pin GPIO4 and it has a 10k resistor like recommended I want to have readings every second So I've done this from time import sleep from datetime import datetime from w1thermsensor import W1ThermSen...
by ricardo.santos
Fri Feb 02, 2018 4:37 pm
Forum: Python
Topic: Help with datetime.strftime
Replies: 8
Views: 2321

Re: Help with datetime.strftime

many thanks.
Now i have plenty of options
by ricardo.santos
Fri Feb 02, 2018 11:11 am
Forum: Python
Topic: Help with datetime.strftime
Replies: 8
Views: 2321

Re: Help with datetime.strftime

WTF

the problem is that the function is strptime and not strftime
dear god!!!!
by ricardo.santos
Fri Feb 02, 2018 11:09 am
Forum: Python
Topic: Help with datetime.strftime
Replies: 8
Views: 2321

Re: Help with datetime.strftime

the code error is

TypeError: descriptor 'strftime' requires a 'datetime.date' object but received a 'str'

the problem is the conversion of string to date time (function strftime)
by ricardo.santos
Fri Feb 02, 2018 10:15 am
Forum: Python
Topic: Help with datetime.strftime
Replies: 8
Views: 2321

Help with datetime.strftime

Don't be to hard on me. I now this should be basic. I'm a newbie I want to calculate a duration between a starting date and current date. My starting date is in a dictionary (as string) why my code doen't run? from datetime import datetime init_data = {'date': '2015-08-30','time': '15:35:20'} init_d...
by ricardo.santos
Fri Jan 26, 2018 10:40 am
Forum: Beginners
Topic: why? Failed to execute operation: Too many levels of symbolic links
Replies: 4
Views: 12056

Re: why? Failed to execute operation: Too many levels of symbolic links

Paeryn
you are a genius
that's it
it's enabled now
thanks a lot
by ricardo.santos
Thu Jan 25, 2018 3:48 pm
Forum: Beginners
Topic: why? Failed to execute operation: Too many levels of symbolic links
Replies: 4
Views: 12056

Re: why? Failed to execute operation: Too many levels of symbolic links

since i do first
cd /etc/systemd/system
i'm placing the symbolic links in that folder i guess

i will try like you said to see if i have changes

by the way i forgot to say that i have Mate and not Raspian if that matters
by ricardo.santos
Thu Jan 25, 2018 2:59 pm
Forum: Beginners
Topic: why? Failed to execute operation: Too many levels of symbolic links
Replies: 4
Views: 12056

why? Failed to execute operation: Too many levels of symbolic links

I need to put two services working sensor-server.service and usb-hotplug.service this is the procedure that i do: cd /etc/systemd/system sudo ln -s /home/pi/fixed-probe/sensor-server.service sudo ln -s /home/pi/fixed-probe/usb-hotplug.service cd /usr/local/bin sudo ln -s /home/pi/fixed-probe/sensor-...
by ricardo.santos
Fri Jan 19, 2018 10:21 am
Forum: Python
Topic: Analogic reading using thread not working! help!
Replies: 7
Views: 1070

Re: Analogic reading using thread not working! help!

In file ----- analogsensor_debug.py--- I moved the sleep from run() to read_turbidity(self) and put it before calling the adc.read_adc(..) In the file ---- sensor-server_debug.py ---- i only put the time variable to print it. see file codes below It runs without error, however the result is not exac...
by ricardo.santos
Thu Jan 18, 2018 10:42 pm
Forum: Python
Topic: Analogic reading using thread not working! help!
Replies: 7
Views: 1070

Re: Analogic reading using thread not working! help!

thanks for all the help i really appreciate it. I will try to apply the suggestions and then i will give some feedback. Also I didn't look at your code close but I didn't see at what stage you start up the run thread and maybe this is why the self.count = 0 I think that when i do turbidity_sensor.st...
by ricardo.santos
Thu Jan 18, 2018 1:13 pm
Forum: Python
Topic: Analogic reading using thread not working! help!
Replies: 7
Views: 1070

Analogic reading using thread not working! help!

hi I have an analog turbidity sensor and i am using a ADC (ads1115) to read it. I intend to get the analog value every 5 seconds , but i want it to be an average (say 10 readings i.e. every 0.5sec) I did the code in 2 files (see below) but i get a divided by zero error that i don't understand. Analo...

Go to advanced search