Whenever I upload an Arduino Sketch it starts to work. Then when I disconnect the USB cable it stops working. I have only experimented with the sample "blink" sketch.
What image version are you using? There is a known issue with the Arduino sketches in the latest image. I suggest you to re-flash your Edison with the previous version: Intel® Download Center.
On the other hand, another user posted a workaround that allows you to keep using the latest image. I haven't tested it yet but you might give it a try: Run Arduino sketch on boot Workaround.
Retrieving data ...