A Simple EPICS IOC with an Arduino with a FunShield

1. Download and install the Arduino sketch from here. The library can be downloaded from here.
The sketch has been tested with an Arduino UNO so far. It is designed to turn on/off the built-in LED with serial commands, read the trimmer value, light sensor value, temperature value, make a sound from the speaker, and read the status of the buttons on board. If you are keeping track of them, this means we have Binary Outputs, Analog Inputs, Analog Outputs, and Binary Inputs.

2. It has the following commands:

Analog input:
trimmerTrimmer Control; this will display some value
lightLight Sensor reading; this will display value from the sensor
tempTemperature Sensor reading; this will display value from the sensor
Analog output:
speakerThe speaker will make some sounds
Binary input:
leftShows the status of the left button (0 or 1)
rightShows the status of the left button (0 or 1)
Binary output:
ronoff[0 or 1]ronoff1 to turn on the Red LED, ronoff0 to turn off the LED
bonoff[0 or 1]bonoff1 to turn on the Blue LED, bonoff0 to turn off the LED
gonoff[0 or 1]gonoff1 to turn on the Green LED, gonoff0 to turn off the LED

The serial port should be set as 9600,8,n,1 (standard configuration). Use \r (or CR) for the line end termination.

3. Make the Device Support similar to the previous exercise.
As the command list above suggests, you will need analog input, analog output, binary input, and binary output prepared for the Device Support.
That means not only you need GPIBREAD, but also GPIBWRITE as well. There are settle difference between GPIBREAD and GPIBWRITE in DSET. Please be careful with that when you write the Device Support for this. Try to understand this tutorial is a key to success.

4. Once successful writing the Device Support for it, then, write an EPICS IOC application using the device support. Once you have that, then, make an MEDM screen so that you can control the Arduino graphically.

NOTE: for some reasons, the performance of the shield/IOC is bit slow. It may take a few seconds before you see any changes via Channel Access. I may come up with a clever solution for it, but right now, I have no idea why it is so slow...