Skip to main content
Share Your Experience: Take the 2024 Developer Survey
7 votes
Accepted

Wrapping libusb library in C++

It is kind of hard to say without seeing the whole code but at a glance the whole thing seems kind of pointless to me. You're not making it object oriented but rather just adding your own "flavor" API ...
Emily L.'s user avatar
  • 16.6k
6 votes

Read and write data to/from Serial Port in C#

There are a number of strange things going on here... First, you have this: ...
Ron Beyer's user avatar
  • 1,051
4 votes

8051 RFID reader for Atmel microcontroller

Here are some ideas that may be useful to you. Decide what's most important Since the 8051, including your AT89S52 variant, has few resources, you'll have to make some hard decisions on how to use ...
Edward's user avatar
  • 66.4k
4 votes

Function to check if received message matches any of the expected messages

Unfortunately your code is incomplete and can't be run in this state. Still I want to recommend some improvements to this snippets. My first impression from this code is that it looks like plain C, ...
Sandro4912's user avatar
  • 3,076
3 votes

Function to check if received message matches any of the expected messages

Use std::span (there are free backports if needed), and see most of the boilerplate evaporate: ...
Deduplicator's user avatar
  • 19.3k
3 votes
Accepted

Feedback on Traffic Light which revolves around Serial Communication

Use a common protocol file Any common constants, such as 9600 SYN, ACK, etc. strings should be ...
Reinderien's user avatar
  • 62.1k
3 votes
Accepted

Handling command code and response code in serial port's DataReceived method

Fall through switch cases Identical case blocks. You can have many clauses fall through to the same block. /* Example A * / Share code in similar cases. You can ...
Blindman67's user avatar
  • 22.1k
3 votes
Accepted

Reading range sensor data from one Serial Port and writing output to another

This ...
Heslacher's user avatar
  • 50.4k
3 votes
Accepted

4x4 Matrix Keypad on Arduino UNO

Your general idea is correct - looping over columns to find out if one of them is active, and then only looping over the rows to find out which button was pressed will be somewhat faster (as in: more ...
OpiF's user avatar
  • 46
3 votes

Serial Port Communication

Just a minor thing that jumped out at me: ...
RobH's user avatar
  • 17k
3 votes
Accepted

Serial Port Communication

I guess you thought about avoiding of Thread.Sleep() method, not Wait() you mentioned in title. I can't test your code because I ...
Tomas Paul's user avatar
3 votes
Accepted

A library that reads incoming scale data from USB

ScaleReader.cs If you do not prefix private fields with _ then IMHO it's better to get used to always use the this.fieldName ...
Adriano Repetti's user avatar
3 votes
Accepted

Simple meter simulator

Disclaimer: None of this review has been tested. I've just applied some manipulation of your original code. Making thing more simple Your dict_of_<something>...
SylvainD's user avatar
  • 29.2k
2 votes

C# SerialPort implementation

The class ComPort is too general - especially for this implementation that is only designed to work with the specific device you're working with. You should rename ...
RobH's user avatar
  • 17k
2 votes
Accepted

RPi script to periodically collect data from Arduino through serial port

A simple technique to avoid busy wait is to import select .... select.select([], [], [], timeout) The timeout is simply ...
vnp's user avatar
  • 56.5k
2 votes

SerialPort C# Class

Usability / Testability The problem of this class is it has a dependency on SerialPort. This is very hard to test. You'd either need a serial port or a USB-2-...
dfhwze's user avatar
  • 13.9k
2 votes

Two bidirectional Software UARTs with AT89S52 microcontroller

You can spare a lot of trouble and cycles by configuring P3.0 as an interrupt source. This way start bit detection would not require constant polling. I don't see why do you test ...
vnp's user avatar
  • 56.5k
2 votes

ROS node to control Dynamixel servo motors

General observation Pack all your code into a personal namespace , you have no reason to don't do it. Modify your includes directory to point also to ...
Calak's user avatar
  • 2,331
2 votes
Accepted

Asynchronous serial port communications class in C++

Use of types As zzz777 already mentioned, consider making enums enum classes for extra type safety. ...
G. Sliepen's user avatar
  • 57.3k
2 votes

Asynchronous serial port communications class in C++

Let us start from nit picking. I would say that makes sense to use modern C++ at least for the sake of using enum class. There is a wide general convention to ...
zzz777's user avatar
  • 178
2 votes
Accepted

Serial port library for unix systems in C using callback model

typedef _t POSIX reserves identifiers ending in _t. You should maybe use ...
alx - recommends codidact's user avatar
2 votes

Simple meter simulator

Since Josay has mentioned all the points that I was going to raise, I'll just say: serial_object is usable in a with and it ...
Peilonrayz's user avatar
  • 43.4k
2 votes
Accepted

Serial port class wrapper for serial port object VB.NET

Is there more code in this class? it looks like other objects are instantiated, but not used: Private ReadOnly Common_Methods As New Common_Class and ...
Homerlander's user avatar
1 vote
Accepted

Converting decimal to binary in Assembly

Readability is poor You should insert more empty lines in order to cleanly separate the logical code blocks. Your use of indentation is not all that consistent. It will improve readability a lot if ...
Sep Roland's user avatar
  • 4,438
1 vote

Function to check if received message matches any of the expected messages

Here are some ideas to help you improve your code. Use const where practical The passed msg parameter is not and probably ...
Edward's user avatar
  • 66.4k
1 vote
Accepted

Arduino Create and send data to Serial Port (Software Serial function)

CreateMessage is a misnomer. The message it creates vanishes as soon as the function returns. Its real purpose it to send a message. So call it appropriately. Too ...
vnp's user avatar
  • 56.5k
1 vote

Serial port data plotter in PyQt

Instead of inheriting from ui_main.Ui_GraphPlotter, I would use the PyQt4.uic module to dynamically load your ui file in the <...
Frodon's user avatar
  • 111
1 vote

Handle data sent back over serial by Arduino

Nobody wants an explicit setTimeout in their async code; you want data as soon as possible. So I'd wrap the Arduino interface in an object that is an ...
Flambino's user avatar
  • 33k

Only top scored, non community-wiki answers of a minimum length are eligible