define output as int variable

Why did you start a new thread? See [url=http://forum.arduino.cc/index.php?topic=425389.0[/url]