Needs["NETLink`"]
InstallNet[];
ser=NETNew["System.IO.Ports.SerialPort","COM4",9600]
ser@Open[]
Button["connect Arduino",ser@Open[]]
Button["disconnect Arduino",ser@Close[]]
{Slider[Dynamic[x],{0,150,1}],Dynamic[x],RunScheduledTask[ser@Write[MakeNETObject[{x,x},"System.Byte[]"],0,2],0.1];"frequency/50"}