Go to advanced search

by mmkw43
Sat Mar 06, 2021 2:54 pm
Forum: Python
Topic: Basic serial stuff
Replies: 0
Views: 22

Basic serial stuff

I have only used microcontrollers with RS232 in the past and never a problem but now trying to interface a PIC to the RPI3B. Some basic questions -- (1) What type of variable is it when you do a serial read? Is it a bytearray? In my code below that's what it looks like (picdata = ser.read(4) ) (2) I...
by mmkw43
Wed Mar 03, 2021 3:46 pm
Forum: Python
Topic: Extract bits from binary?
Replies: 4
Views: 155

Re: Extract bits from binary?

I'm using this. It's working fine although I'm sure the code be more compact. Is there an easy way to get LSB instead of MSB ? Thank you. try: ser = serial.Serial("/dev/serial0",baudrate=2400) except SerialException: pass picdata = ser.read(4) x = list(picdata) qone = (x[0]) qtwo = (x[1]) ...
by mmkw43
Tue Mar 02, 2021 10:37 pm
Forum: Python
Topic: Extract bits from binary?
Replies: 4
Views: 155

Re: Extract bits from binary?

Thanks -- and it seems also (through my playing with it) that I can simply -- var1 = (d[2]) d is the binary number in my code above var2 = (d[3]) etc? so in python you ignore bits 0 and 1 (b and 0) and the byte starts at [2] through [9] ? what is the option to get MSB or LSB ? I'll try and get 8 var...
by mmkw43
Tue Mar 02, 2021 8:34 pm
Forum: Python
Topic: Extract bits from binary?
Replies: 4
Views: 155

Extract bits from binary?

Got my serial problem solved but stumped on how to look at each bit in a binary number. a = ser.read(4) b = list(a)) c = (b[2]) d = bin(c) and need to check d bits for set/not set and create 8 variables for the bits. spent 2 hours trying to learn how but can't find it. I believe it involves the bitw...
by mmkw43
Tue Mar 02, 2021 4:09 pm
Forum: General discussion
Topic: RS485 module Vss ?
Replies: 1
Views: 67

Re: RS485 module Vss ?

I see quite a few post and YT videos using this module with the pi but the max485 module is 5v only ?
by mmkw43
Tue Mar 02, 2021 2:31 pm
Forum: General discussion
Topic: RS485 module Vss ?
Replies: 1
Views: 67

RS485 module Vss ?

I want to interface a 5v pic microcontroller between one of these ebay rs485 modules and the PI3 B. What Vss do you connect the module to? 5v or 3.3v? Obviously, I will have to connect to the 5v on the pic for the other module. Any issues? I know you have to keep 5v out of the Uart pins? THANKS. edi...
by mmkw43
Mon Mar 01, 2021 10:13 pm
Forum: Python
Topic: PI3 B uart setup
Replies: 9
Views: 363

Re: PI3 B uart setup

figured it out.
made some dumb moves.
serial in initialize? nope.
by mmkw43
Mon Mar 01, 2021 8:55 pm
Forum: Python
Topic: PI3 B uart setup
Replies: 9
Views: 363

Re: PI3 B uart setup

anyway -- I can't get anything to happen. class myClass: def __init__(self): ser = serial.Serial("/dev/serial0",baudrate=9600) def function(self): data = ser.readline() and I get a name error that ser is not defined. there's much more to the code but this is crazy -- from the examples I've...
by mmkw43
Mon Mar 01, 2021 7:49 pm
Forum: Python
Topic: PI3 B uart setup
Replies: 9
Views: 363

Re: PI3 B uart setup

Ok -- can't believe it. Started this today and simply did this -- ser = serial.Serial("/dev/ttyS0") is it ttyS0 or serialS0 ? ser.baudrate = 9600 and I put that in a class initialize (can I?) then I simply did this in a function that's in that class, picdata = ser.readline() and I get an e...
by mmkw43
Sun Feb 28, 2021 2:59 pm
Forum: Python
Topic: PI3 B uart setup
Replies: 9
Views: 363

Re: PI3 B uart setup

Ok thanks very much. That makes sense of course but these details need to be spelled out somewhere so you actually know what's going on. Plenty of other parts, (microcontrollers etc) always require a setup first and that's my mindset. edit -- I guess when you enable serial comm in raspi-config it fi...
by mmkw43
Sat Feb 27, 2021 11:23 pm
Forum: Python
Topic: PI3 B uart setup
Replies: 9
Views: 363

Re: PI3 B uart setup

Well, what I mean is how do you setup the pin? LIke GPIO.setup(10, GPIO.IN) to make an input But how to implement the Uart instead ? ! I spent all day trying to find this. Drove me nuts. You can't find anything anymore in searches. Take me back to 1992 and Alta Vista. I'm guessing it might be (10,RX...
by mmkw43
Sat Feb 27, 2021 7:01 pm
Forum: Python
Topic: PI3 B uart setup
Replies: 9
Views: 363

PI3 B uart setup

For some reason, the world of search results has become absolutely useless in the past few years so I can't believe I'm asking this but -- how in the heck do you setup pins 8 and 10 to be assigned to the UART? I'll assume the default setup is GPIO. Even something as basic as this and all the links l...
by mmkw43
Wed Feb 24, 2021 8:13 pm
Forum: Python
Topic: Serial port basics
Replies: 3
Views: 159

Re: Serial port basics

dagnabit.

I missed that short introduction. Ok thanks fellas, I'm good to go now.
(We'll see).
by mmkw43
Wed Feb 24, 2021 5:54 pm
Forum: Python
Topic: Serial port basics
Replies: 3
Views: 159

Serial port basics

Once again I'm trying to just get the basics about another aspect of python with dozens of ridiculous youtube videos and poor search results in an effort to just get the bare necessities s p e l l e d out. It would be so nice if the RPI pages had simple, short tutorials on the popular modules becaus...
by mmkw43
Thu Feb 18, 2021 5:25 pm
Forum: General discussion
Topic: Touchscreen tutorial
Replies: 2
Views: 91

Touchscreen tutorial

I've never used a touchscreen at all and looking for a good basic understanding of HOW a pi would even communicate with one. I realize that on the models specific for the PI, there is a connection between the GPIO pins and the monitor, so that makes sense but how in the heck do you setup a conventio...
by mmkw43
Wed Feb 17, 2021 2:53 pm
Forum: Python
Topic: Huh ? -- writelines()
Replies: 9
Views: 256

Re: Huh ? -- writelines()

Thank you -- lesson learned. I didn't know what I was getting into. Thought it would be more straightforward and as easy as using pickle, which I've always done before.
by mmkw43
Wed Feb 17, 2021 12:29 am
Forum: Python
Topic: Huh ? -- writelines()
Replies: 9
Views: 256

Re: Huh ? -- writelines()

Maybe I have the wrong impression about saving to a text file. I had several separate text files that were saving individual strings and thought I could consolidate them. (I've done it with pickle, so maybe I have to go back to that). I thought that I could save multiple strings and end up parsing t...
by mmkw43
Tue Feb 16, 2021 9:51 pm
Forum: Python
Topic: Huh ? -- writelines()
Replies: 9
Views: 256

Re: Huh ? -- writelines()

I thought I had it but honestly I'm thoroughly confused on this. The file writes fine one line at a time and I'm writing 8 strings. with open('all.txt','w') as fw: a = ck.get() fw.write(a+'\n') b = dg.get() fw.write(b+'\n') that writes it all fine but I can't figure out how to decipher each line to ...
by mmkw43
Tue Feb 16, 2021 8:35 pm
Forum: Python
Topic: Huh ? -- writelines()
Replies: 9
Views: 256

Re: Huh ? -- writelines()

var[0]
var[1] #figured it out and kicking myself
by mmkw43
Tue Feb 16, 2021 8:14 pm
Forum: Python
Topic: Huh ? -- writelines()
Replies: 9
Views: 256

Re: Huh ? -- writelines()

well, this is embarrassing as heck but I'm going in circles trying to get back one line at a time when I read a text file. I've really never used a text file for data other than a single line -- I used pickle for multiple items and that went smoothly. BIG THANKS. a = 'bob' b = 'roy' fw = open("...
by mmkw43
Tue Feb 16, 2021 6:38 pm
Forum: Python
Topic: Huh ? -- writelines()
Replies: 9
Views: 256

Re: Huh ? -- writelines()

well ships, I was under the impression it didn't need \n after all it's called writelines
by mmkw43
Tue Feb 16, 2021 6:00 pm
Forum: Python
Topic: Huh ? -- writelines()
Replies: 9
Views: 256

Huh ? -- writelines()

I've always just used write() without a problem, never used writelines() Checked over and over again all I could find on it yet this writes everything to a single line in all.txt From what I understood, each string should be on a seperate line. What am I doing wrong? (!) The strings are right, just ...
by mmkw43
Sun Feb 14, 2021 2:48 pm
Forum: Graphics programming
Topic: tkraise() -- need confirmation
Replies: 3
Views: 224

Re: tkraise() -- need confirmation

Thanks much. I should have tried it a long time ago -- ran across raise() a long time ago but I think the wording in the docs really had me stumped.
by mmkw43
Sat Feb 13, 2021 3:47 pm
Forum: Graphics programming
Topic: tkraise() -- need confirmation
Replies: 3
Views: 224

tkraise() -- need confirmation

I had asked about giving a widget "priority" a few different times here on the forum and walked away mystified that there wasn't a solution. So after all this time with my only real frustration about tkinter, it seems as easy as using tkraise(). I'm only posting this to confirm. I can simp...
by mmkw43
Wed Feb 10, 2021 3:53 pm
Forum: Python
Topic: Decompile PYC
Replies: 1
Views: 137

Decompile PYC

Before I delve into pyarmor and the world of obfuscating, I wanted to ask just how easy is it to get accurate source code out of these decompilers I've read about ? Are they "that' effective? Or not worth the hassle for most? I read where they will ignore comments? I read briefly about a couple...

Go to advanced search