Matatino
Matatino is a Cocoa framework for Mac that provides a straight-forward way to communicate with your Arduino through its serial connection. To get started, visit our tutorial on how to add Matatino to your Xcode project!Matatino uses AMSerialPort (with modifications from xcode-arduino-serial-communication). Matatino was based off of xcode-arduino-serial-communication.
Matatino is Open Source under the BSD 3-Clause license! Fork the repository, and modify it all you want. We encourage you to redistribute the code. If you do create something cool or improve upon Matatino, let us know!
Download Matatino.framework!
Matatino.h
Variablesid<MatatinoDelegate> delegateDelegate for receiving the callbacks. See below for the callback methods.
BOOL debugTriggers NSLog() statements inside the code. Set to NO by default.
Init
- (id)initWithDelegate:(id <MatatinoDelegate>)aDelegateInitializes the Matatino object with a specific delegate. We recommend using this instead of -init and manually setting the delegate.
Connect/disconnect
- (BOOL) connect:(NSString *)deviceName withBaud:(long)baudConnects the Arduino with a certain baud rate.
The deviceName is the AMSerialPort bsdPath. You can access an array of all the bsdPath's by using -deviceNames (below).
The baud rate long that is passed must be one of the standard speeds as defined in termios.h. Here are the speeds listed out:
#define B0 0 #define B50 50 #define B75 75 #define B110 110 #define B134 134 #define B150 150 #define B200 200 #define B300 300 #define B600 600 #define B1200 1200 #define B1800 1800 #define B2400 2400 #define B4800 4800 #define B7200 7200 #define B9600 9600 #define B14400 14400 #define B19200 19200 #define B28800 28800 #define B38400 38400 #define B57600 57600 #define B76800 76800 #define B115200 115200 #define B230400 230400
- (void) disconnectSafely disconnects the connected device.
- (BOOL) isConnectedChecks if the Arduino is connected. If the Arduino is connected, returns YES. Otherwise, NO.
Send data
- (BOOL) send:(NSString *)txSends a NSString to the connected device. A \r is appended the end of the NSString.
The NSString is written using NSUTF8StringEncoding encoding.
Returns NO if the port was not open, or if there was an error sending the data. Otherwise, returns YES.
Serial related
- (NSArray *) deviceNamesReturns a NSArray of NSStrings. The strings are all the AMSerialPort's bsdPath.
- (AMSerialPort *) portReturns the current AMSerialPort. You will probably never need to use this.
- (void) setPort:(AMSerialPort *)newPortSets current AMSerialPort to a new AMSerialPort. You probably never need to use this.
MatatinoDelegate Callbacks
- (void) receivedString:(NSString *)rxCalled when the Arduino sends data to the Mac. The NSString uses NSASCIIStringEncoding encoding.
- (void) portClosedCalled whenever a port is closed. When you stop the communication to the Arduino, this is called.
- (void) portAdded:(NSArray *)portsCalled when a port is added. This is useful to update a pulldown menu of all the ports, for example.
Has a NSArray of NSString- they are AMSerialPort bsdPath's.
- (void) portRemoved:(NSArray *)portsCalled when a port is removed. This is useful to update a pulldown menu of all the ports, for example.
Has a NSArray of NSString- they are AMSerialPort bsdPath's.
Legal
Arduino (http://arduino.cc)"Arduino" is a trademark of Arduino team.
AMSerialPort (http://sourceforge.net/projects/amserial/)
Copyright (c) 2001 Andreas Mayer. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
xcode-arduino-serial-communication (http://code.google.com/p/xcode-arduino-serial-communication/)
Copyright 2009 POP - Pat OKeefe Productions. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Matatino (http://robotgrrl.com/apps4arduino/matatino.php)
Copyright © 2011, RobotGrrl.com. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the RobotGrrl.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


