Jan,
There are several examples of this in the books that have been written for the Arduino and ham radio. I am not at home so I can't give you the titles until next week.
I also have incorporated SWR and Power reading into an amplifier controller that uses an Arduino Mega. The code for this is very simple. The hardest part is the bi-directional coupler. I have built a couple of homebrew ones but have not been satisfied with their operation. I switched to use on from Wavenode. Their detector sells for $65 and it is worth every penny.
The output for this detector, and all others, is logarithmic, not linear, so your Arduino code will have to have the math to convert the output from the detector to power. Once you have forward and reflected power it is very easy to calculate SWR.
73,
Don
K9AQ