|
Project Information
Featured
Downloads
|
IntroductionThis project provides a simple view with a drop-down menu to select a serial device, connect to it, see incoming data, and send data to the connected device. It has been created for use with the Arduino platform, but I'm sure the intrepid programmer can make use of this for any serial device. The most interesting file is ViewController.m. I have put a couple //TODO: comments in there to show where you can change the baud rate and make use of the incoming data. In my source, the incoming data is just printed to the console. It would be useless for me to try to set up something else because each use of this code will require a completely different implementation for working with incoming data. UsageYou should just be able to 'Build & Go' with the XCode project. Select an appropriate serial device and hit connect. It happens nearly instantaneously for me every time. Make sure you have the console window open to see the incoming data. Check out the 'Example Sketches' to see two simple serial programs for an Arduino. Below is a picture of the program working with one of the examples. The simple example demonstrates the difference between Serial.print() and Serial.println() You can call Serial.print() as many times as you want, but the Xcode project is waiting for a Serial.println() before it reports everything it has received. This is just a matter of convenience for me, and hopefully for you as well. ThanksThis project could not have succeeded without the work of Andreas Mayer and AMSerialPort. Site: http://www.harmless.de/cocoa.php FYI, I did change AMSerialPort in two ways. The first was to fix whatever was wrong with changing the baud rate. The second was to slightly change how the background thread listens for data to work better with the Arduino platform.
|