473,756 Members | 4,165 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can i send 8-bit data or binary data with pyserial?

hi,

I want to transfer 0 bit and 1 bit in order with pyserial.But pyserial only
send string data.
Can anyone help me?
Sorry about my english..

_______________ _______________ _______________ _______________ _____
Depolama alani sikintisindan kurtulun - hemen Hotmail'e üye olun!
http://odeme.hotmail.com.tr

Jul 18 '05 #1
3 4779
Hi !

1 byte is 8 bits. If you want to manage bits, one by one, you can rewrite a
protocol, and replace pyserial.

Have a good day
--
Michel Claveau


Jul 18 '05 #2
> I want to transfer 0 bit and 1 bit in order with pyserial.But pyserial
only send string data.


Convert your data to numbers and use module struct to create strings out of
it.

Apart from that: You can only send chunks of bits as configured in your
serial settings - e.g. 8N1 means that you will have to send 8 Bits in a
row. I personally never used anything else, but it might be possible to
alter that setting to lets say 7N1 or even lower numeber - but I doubt that
this will work down to 1N1.

If you give us more details on your actual problem, we migh be able to give
better answers.
--
Regards,

Diez B. Roggisch
Jul 18 '05 #3

"ouz as" <og*********@ho tmail.com> wrote in message
news:ma******** *************** *************** @python.org...
I want to transfer 0 bit and 1 bit in order with pyserial.But pyserial only
send string data.


string _is_ the type one would normally use in Python for 8-bit
encoded data. If you are a Unicode purist, that's perhaps
all you would use it for.

If you have a list [11, 22, 33] of bytes to send, you can write:
buffer = [chr(i) for i in [11, 22, 33]]

Or possibly, use the struct or array module. Either way, the
problem you have to solve is converting the format you have
to/from an appropriate string. We lack the detail to suggest the
best solution to that.
Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
7996
by: Pete Loveall | last post by:
I have a server application that monitors a private local queue for messages. The message sent to it has a label and a response queue defined. It works correctly when the queue is accessed via another program. However, when I attempt to Send a message from an ASP.NET VB page, I get "One or more of the passed properties are invalid." I have tried different combinations of the non-transactional Send() with no success. My Windows\Temp...
0
3710
by: David Burson | last post by:
Hi, I have a VB.NET windows app that needs to automatically send a simple text email when my users run a new version of the app for the first time. I thought this would be simple, but after days of reading posts and testing, I see it is not - unless I'm missing something? I'm not an email guru. All of my users will be running at least Windows 2000, most on XP sp2. Some of my users will have Outlook, many will be using Outlook...
15
3316
by: Steve Horrillo | last post by:
I can't figure out why this script won't insert the subject in the email and why can't I control the font and size being used? I'm not sure where to post this. Let me know where if this is OT. <SCRIPT LANGUAGE="JavaScript"> <!-- Begin function isPPC() { if (navigator.appVersion.indexOf("PPC") != -1) return true; else return false;
3
4559
by: Gerard | last post by:
Hello I have created a windows service to monitor a database, it starts some checks when a timer elapses. The checks send emails depending on their findings. My issue is that when I created a windows application it worked fine, however I need to use a service as I don't want to rely on a user being logged in. The errors I get are: Index #:System.Web.HttpException: Could not access 'CDO.Message' object. --->...
14
9142
by: supz | last post by:
Hi, I use the standard code given below to send an email from an ASP.NET web form. The code executes fine but no Email is sent. All emails get queued in the Inetpub mail queue. I'm using my local default SMTP Server and my from address is a valid Yahoo/Hotmail address. I have configures the local SMTP Server to allow the IP Address 127.0.0.1.
3
2189
by: ultr | last post by:
Hello, I have read that send() may not send whole message and returns the nuber of bytes sent, so that we can handle the rest of the message. Is it true, because i have tested sending even 1MB long message by the Internet connection and it was sent in one message - send() returned length of whole message? And the second question: If we really need to send the rest of the message, what should i do if client disconnects while sending...
15
8592
by: cj | last post by:
How can I get a button in VB to send the contents of a text box via email in a manner similar to the "Send To\Mail Recipient" functionality that you can select via right clicking a file in Windows Explorer? I want the user to click a button and it lunch the users default email client and put the contents of a multi line text box in the body of the message and the contents of another text box in the title box and be sitting there read for...
4
7684
by: =?Utf-8?B?dHBhcmtzNjk=?= | last post by:
I have a web page that at the click of a button must send a bunch (1000+) emails. Each email is sent individually. I have the code working fine, using Mail Message classes and smtp and all that. But sometimes even when I'm just sending one e-mail the web page takes a minutes or so to post. Can anyone tell me why it is so slow, or how to fix the problem? To address this I am thinking of just creating a queue table to write the emails...
9
77440
by: Mahernoz | last post by:
Can i send an email from JavaScript? Is it possible? If yes please the code to send email using javascript...
6
6895
by: Harshpandya | last post by:
Hi all, I am working on the form in which you fill out the whole PHP form and e mail that details to someone. It is working fine. But now i want to send the same form to be sent to different people and user should be able choose the check boxes to whom they want to send e mail to. I write some code simple If else conditions but i think i am making some mistakes. Because when i tried - it is not sending them e mails. Here is my code. I...
0
9297
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10069
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9904
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9884
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9735
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6556
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5324
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3395
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.