updated serial.write/println
modified input to control gain