Works fine at 115200 but does not at 9600 baud

I recommend the Serial Input Basics tutorial, and to avoid Strings.