Go to advanced search

by California
Sun Nov 10, 2019 12:56 pm
Forum: Python
Topic: Conversion
Replies: 17
Views: 374

Re: Conversion

Thanks to all of you, code works as expected.

With best regards,

Vlado
by California
Sun Nov 10, 2019 12:07 pm
Forum: Python
Topic: Conversion
Replies: 17
Views: 374

Re: Conversion

@billio:
so far so god, it looks ok - I have to do more tests

@rpiMike:
your result is also ok, but it is coded in normal float 32 (IEEE) standard, for me it is used Microchip float 32 standard
by California
Sun Nov 10, 2019 7:13 am
Forum: Python
Topic: Conversion
Replies: 17
Views: 374

Re: Conversion

First of all, I want to thank all of you for your help here. The purpose of this part of the code is converting temperature setpoint (float) into bytes on the Rpi3 which represents master in RS485 network. Floating point number 5.1 is just an example, could be used any other positive or negative num...
by California
Sat Nov 09, 2019 7:47 pm
Forum: Python
Topic: Conversion
Replies: 17
Views: 374

Re: Conversion

In python 2 result is: (129L, 35L, 51L, 51L)
In python 3 result is: (129, 35, 51, 51)

As you can see, diference is in the letter L. Maybe this is what error message say.
So, how to get the letter L into result?
by California
Sat Nov 09, 2019 6:43 pm
Forum: Python
Topic: Conversion
Replies: 17
Views: 374

Re: Conversion

@jahboater: your lines of the code works ok, but not with the rest of the code lines. The very same error as before: ... i %= 4294967296 TypeError: not all arguments converted during string formatting @rpiMike: described part of the code works ok, but yes, your solution looks much better than my... ...
by California
Sat Nov 09, 2019 4:10 pm
Forum: Python
Topic: Conversion
Replies: 17
Views: 374

Re: Conversion

Well, it's strange for me. Code below works ok, but together with the rest of the code lines error is shown. BTW, result is correct. def convert_long_to_bytes(i): i = i % 4294967296 n4 = i % 256 i = i / 256 n3 = i % 256 i = i / 256 n2 = i % 256 n1 = i / 256 n1 = int(round(n1)) n2 = int(round(n2)) n3...
by California
Sat Nov 09, 2019 12:24 pm
Forum: Python
Topic: Conversion
Replies: 17
Views: 374

Re: Conversion

Thanks for your answer, it alows me to go forward through the code execution - almost to the end. Code looks now: import struct def convert_long_to_bytes(i): i = i % 4294967296 n4 = i % 256 i = i / 256 n3 = i % 256 i = i / 256 n2 = i % 256 n1 = i / 256 return (n1, n2, n3, n4) def convert_float_to_MI...
by California
Sat Nov 09, 2019 8:18 am
Forum: Python
Topic: Conversion
Replies: 17
Views: 374

Re: Conversion

the first error is: Traceback (most recent call last): File "/home/pi/Desktop/convert_float_to_MICROCHIP_32bit_py27.py", line 47, in <module> b = convert_float_to_MICROCHIP_32bit(a) File "/home/pi/Desktop/convert_float_to_MICROCHIP_32bit_py27.py", line 15, in convert_float_to_MICROCHIP_32bit x_IEEE ...
by California
Sat Nov 09, 2019 6:34 am
Forum: Python
Topic: Conversion
Replies: 17
Views: 374

Conversion

Hello, I am facing with mooving some code from python 2 to python 3. Code below works just ok in python 2 but not in python 3. So your help would be very appreciated. import struct def convert_long_to_bytes(i): i = i % 4294967296 n4 = i % 256 i = i / 256 n3 = i % 256 i = i / 256 n2 = i % 256 n1 = i ...
by California
Sat Mar 09, 2019 9:59 pm
Forum: Networking and servers
Topic: How to set static IP addres on Raspbian Strech full
Replies: 4
Views: 1681

Re: How to set static IP addres on Raspbian Strech full

Thanks, it works ok. It was done by manual from link above.

Regards, Vlado
by California
Sat Mar 09, 2019 7:35 pm
Forum: Networking and servers
Topic: How to set static IP addres on Raspbian Strech full
Replies: 4
Views: 1681

How to set static IP addres on Raspbian Strech full

Hello, I want to set static IP address (for example) 192.168.1.28 on my Pi3B. Following some web links gave no results for me.
https://linuxconfig.org/how-to-setup-a- ... bian-linux
Regards,
by California
Sat Feb 16, 2019 1:25 pm
Forum: Python
Topic: Converting python 2.7 code to python 3.4
Replies: 11
Views: 864

Re: Converting python 2.7 code to python 3.4

Thanks, got solution in code below: def convert_MICROCHIP_32bit_to_float(x): if x == 0: x = 1231459733 x_hex = format(x, 'x') bits = bin(int(x_hex, 16))[2:].zfill(len(x_hex) * 4) i = 0 val = " ".encode() b_s = list(val) for char in bits: current_bit = int(char) if current_bit == 1: if i < 8: b_s[i +...
by California
Sat Feb 09, 2019 4:25 pm
Forum: Python
Topic: Converting python 2.7 code to python 3.4
Replies: 11
Views: 864

Re: Converting python 2.7 code to python 3.4

Thanks, one step more: def convert_MICROCHIP_32bit_to_float(x): if x == 0: x = 1231459733 x_hex = format(x, 'x') bits = bin(int(x_hex, 16))[2:].zfill(len(x_hex) * 4) i = 0 val = " ".encode() b_s = list(val) for char in bits: current_bit = int(char) if current_bit == 1: if i < 8: b_s[i + 1] = "1" eli...
by California
Sat Feb 09, 2019 1:06 pm
Forum: Python
Topic: Converting python 2.7 code to python 3.4
Replies: 11
Views: 864

Re: Converting python 2.7 code to python 3.4

Thanks, below is solutionfor that part of the code: readBuffer = array.array('i') readCount = 0 while readCount < maxReadCount: readBuffer.append(ord(ser.read(1))) readCount = readCount + 1 i = 0 while i < maxReadCount: val = readBuffer[i] if i == 4: power_situation = int(val) i = i + 1 but new isss...
by California
Sat Feb 09, 2019 10:33 am
Forum: Python
Topic: Converting python 2.7 code to python 3.4
Replies: 11
Views: 864

Re: Converting python 2.7 code to python 3.4

Thanks for the reply. Next step of convertion: readBuffer = array.array('b') readCount = 0 while readCount < maxReadCount: readBuffer.append(ser.read(1)) readCount = readCount + 1 i = 0 gives an error readBuffer.append(ser.read(1)) TypeError: an integer is required (got type bytes) Any help Regards ...
by California
Mon Feb 04, 2019 3:58 pm
Forum: Python
Topic: Converting python 2.7 code to python 3.4
Replies: 11
Views: 864

Converting python 2.7 code to python 3.4

Dear all, below is part of the working code for RS485 communication between PC and Microchip PIC18F458 deweloped in python 2.7. I woul like to move to python 3.4 with my codding, so your help would be very appreciatted. The general problem for me is part of the code with: readBuffer = array.array('c...
by California
Wed Jun 27, 2018 6:11 am
Forum: Other
Topic: Install Windows 10 Arm For Raspberrypi 3B
Replies: 1
Views: 6993

Re: Install Windows 10 Arm For Raspberrypi 3B

Hello, any progress on this subject?

Regards, Vlado
by California
Wed Dec 20, 2017 8:36 pm
Forum: Raspberry Pi Desktop for PC and Mac
Topic: VNC on Raspberry Pi Desktop for PC and Mac
Replies: 9
Views: 3024

Re: VNC on Raspberry Pi Desktop for PC and Mac

You can acces Raspberry Pi Desktop for PC with remote desktop

Code: Select all

sudo apt-get install xrdp
Regards
Vlado
by California
Thu Dec 14, 2017 10:21 am
Forum: Raspberry Pi Desktop for PC and Mac
Topic: VNC on Raspberry Pi Desktop for PC and Mac
Replies: 9
Views: 3024

Re: VNC on Raspberry Pi Desktop for PC and Mac

Thanks for the respond. Instructions about installing Chromium gave no result. Even after reboot.

Vlado
by California
Thu Dec 14, 2017 8:15 am
Forum: Raspberry Pi Desktop for PC and Mac
Topic: VNC on Raspberry Pi Desktop for PC and Mac
Replies: 9
Views: 3024

VNC on Raspberry Pi Desktop for PC and Mac

So how to install VNC server on Raspberry Pi Desktop for PC and Mac, becouse command below doesn't work.

Code: Select all

sudo apt-get install realvnc-vnc-server realvnc-vnc-viewer
Also Chrommium web browser doesn't work either, is there any trick to get it work?

Regards, Vlado
by California
Mon Oct 09, 2017 12:01 pm
Forum: Python
Topic: Python IDE
Replies: 10
Views: 4319

Re: Python IDE

jahboater wrote:
Thu Oct 05, 2017 7:40 pm
And for the long term solution, start using Python 3 :)
Ok, with some new project python 3 could be my tool in future.
Actual project is to large to move to python 3.

Regards
by California
Thu Oct 05, 2017 4:32 pm
Forum: Python
Topic: Python IDE
Replies: 10
Views: 4319

Re: Python IDE

Would you be so kind to explain how to manage to work with python 2.7?
There is written that only python 3.4 and later is supported ...
by California
Thu Oct 05, 2017 4:12 am
Forum: Python
Topic: Python IDE
Replies: 10
Views: 4319

Python IDE

What python (2.7) IDE do you recomend instead of Ninja, which doesn't work anymore?

Regards, Vlado
by California
Sun Sep 24, 2017 6:16 am
Forum: Python
Topic: How to run GUI application at boot
Replies: 11
Views: 20642

Re: How to run GUI application at boot

Hm, it doesn't work ... Have you tried using autostart as shown in the link in the 1st reply by topguy? nano /home/pi/.config/lxsession/LXDE-pi/autostart Your entry in autostart should look something like this added to the end of what's there already: @lxterminal -e python /home/pi/Project/Master_0...
by California
Sat Sep 23, 2017 8:16 pm
Forum: Python
Topic: How to run GUI application at boot
Replies: 11
Views: 20642

Re: How to run GUI application at boot

Hm, it doesn't work ...

Go to advanced search