tmccafferty

I have an application in which I need to read the status of 4 switches and one analog voltage with a MAC MINI. I have chosen an Arduino Micro and the input device and want the MAC to be able to read the status/values via a USB input. I am a newbee, but the part of the Arduino code to read the inputs looks real simple so no worries there. What I don't have a clue about is the communications between the MAC and the Arduino.

Would someone point me in the correct direction? Are there any existing libraries that will help?

tmccafferty

Someone else will be doing the MAC software and can likely use whatever....

So, when you say the Arduino looks like a serial port, I assume when I plug it in, the MAC will assign it to a com port.

Where can I learn about the protocol or how to configure the data on the Arduino so to MAC can ask for it. Maybe my lack of knowledge is making this harder than it is. I remember from dinking with the Arduino environment several months ago, doing a tutorial where you would write values to the serial monitor app in the Arduino development environment. I guess from the Arduino end, I would handle it like that. Maybe every half second, output the values for the MAC to catch. Or, would you set it up so the MAC sends a request to the Arduino and then the Arduino responds with the results?

I know this if very basic, but if I can get the basic operation understood, I can go off an do the pieces. Do you recommend an approach for the MAC?

"Com Port" is more a Windows thing. On the Mac (like Linux) it's a device file like /dev/tty.usbmodem3a21 (my Arduino UNO) or /dev/tty.usbserial-A6004peF (older Diecimila with FTDI chip). It's the same name that shows up under Tools->Serial Port.

There is also a corresponding "/dev/cu." device. I don't know what that is for.

If you send data unsolicited you have to be careful not to send any faster than the program can process the data. A few messages per second should not be a problem. More than about 10 messages a second and you should probably only send when you get a request from the Mac.

Be sure to put in some kind of message framing so the program on the Mac can detect the start and end of messages and perhaps a checksum so the program on the Mac can check the message for validity.