Arduino - Serial. Serial communication on pins TX/RX uses TTL logic levels (5. V depending on the board). Don't connect these pins directly to an RS2.
I am writing a realbasic console application which polls several serial ports for data and saves the results to a database. My initial idea was to open the port, read the data and then close it again, The problem is, that opening a serial port can take up to 4 seconds and I may need to read from up to 8 ports, so opening and closing the port is not practical for each cycle.
It's highly possible that the serial device disconnected from an opened port, and of course this is going to cause problems. So is it possible to detect whether a port is open and alive so that I can leave the port open and only close and re-open it when I detect that the connected device has gone away. Edit The serial port is a bluetooth serial port, it is talking to a bluetooth radio which in turn talks to a microcontroller. I have start and end characters which I listen for and all of this works fine, until the bluetooth device goes out of range and effectively disconnects leaving the serial port still open.
I can of course close the port and try and open it again, but instead I would like to detect whether the device is still connected to the bluetooth serial port. Also, calling serial.close() on a serial port on OSX causes a momentary freeze (desktop cursor freezes), I suspect 100% cpu usage, this does not happen on windows and I therefore want to minimize the number of port opens and closes that I have to do as I am polling data from around 10 bluetooth devices once a minute. As it takes up to 4 seconds to open a serial port, the best solution would be to use a direct HID connection to the bluetooth radio instead of a SPP serial connection, however it appears that nobody has ever connected realbasic to a bluetooth HID device before and so there's no info or help on it. It's been a few years since I did Serial programming in RB, so I don't recall everything.
The Serial class has a 'LineStateChanged' event. Bounce Symphony Game Free Download Full Version. Have you checked if that gets invoked once the BT conn is lost or reconnected? If that doesn't work, you could try using the low level BSD/POSIX functions to open the port and use ioctl() calls to figure out its state. I don't have any examples for this, though. And I'm not even sure that this is the right way to do it. It probably comes down to learning what a C program would do, and translate that to RB. About the bad performance: That's usually due to RB's limited control over its event management: It doesn't see that it needs to poll the serial port more often, and thus only checks on it rarely as long as it has no other reasons to ask for more idle time from the OS.
The trick is to run a Timer with a high frequency (e.g. Zolid High Speed Dvd Maker Driver Windows 7 here. Once every 10ms), and then invoke the serial port's Poll function from the Timer's Action event. Your request is kind of odd because typically what you do is connect to the serial port and then wait to receive any data sent to that port. Let me put it another way. The serial port does not store any data waiting to disgorge for you when you connect. You're either listening or your not.
You have to connect to the port and listen for data. Once you receive DataAvailable events you can start processing data but be aware that not all data in the stream may have been received and processed before the event occurrs. You generally need to determine what the End of Message is. Sometimes this is a Carraige Return and sometimes not. Depends on the system. More information on DataAvailable.
Python is a general purpose language with tremendous community support and a 'batteries-included' philosophy that leads to simple-designs that focus on the business problem at hand. It is a good choice for a wide variety of projects. The only reasons not to choose Python would be: • You (or your team) have greater experience in another general purpose language with good library and community support.
• You have a particular problem that is handled best by a specialty language that was written with that sort of problem in mind. The only thing I know about RealBASIC is that I hadn't heard of it until now, so it's a lock that it doesn't have quite the community of Python.
(Exhibit A: 60,000 Python questions on SO, only 49 RealBASIC questions.) And if it is a derivative of BASIC, it would be not be a specialty language. Python seems a clear choice here, unless it means learning a new language, and you are proficient with RealBASIC.