C# use usb as serial port




















ReadLine ; Console. Mitch Mitch Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Stack Gives Back Safety in numbers: crowdsourcing data on nefarious IP addresses. Posted 7-Jun am jfriedman.

First, USB is not a "port" it is a bus, not unlike the expansion slots inside your computer. You cannot treat the USB ports like you do serial ports. Second, how you communicate with the device depends on the interfaces it and its driver exposes. Without knowing that, you're going to get nowhere pretty fast. Posted 7-Jun am Dave Kreskowiak. Add your solution here. OK Paste as. Treat my content as plain text, not as HTML.

Existing Members Sign in to your account. This email is in use. Do you need your password? Submit your solution! When answering a question please: Read the question carefully. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem.

Insults are not welcome. However, to write this data to the TextBox on a form, we need to create a delegate. NET does not allow cross-thread action, so we need to use a delegate. The delegate is used to write to the UI thread from a non-UI thread. We can now receive data from a serial port device and display it on a form. Some devices will send data without being prompted. However, some devices need to be send certain commands, and it will reply with the data that the command calls for.

For these devices, you will write data to the serial port, and use the previous code to get the data that will be sent back. In my example, I will be communicating with a scale. This command is specific for this scale. Also, in the sample code, there is a line Context Since it was an activity, Context was directly used.

However when using that in a Content Page, it got changed to Android. Maybe this can also return null. Finally, if you can spare some time, pls download the sample project and try to find out about its implementation in a ContentPage.

I just want to use it in my project and I have no idea about its implementation. I also found a Nuget package Xamarin. SerialPort nothing for Xamarin. However, the Github link of the project is also not working so I didn't get its implementation either. Is communicating with serial ports so hard in Xamarin that no examples, no video tutorials are available on the web?

Also, no one is ready to answer the question on Forums by giving codes. Most of the answers only direct to some links with more information but no exact implementation. If you can, pls post some code to benefit all the novice Xamarin developers like me!

I have already made a serial communication program in C.



0コメント

  • 1000 / 1000