Can't get this switch / case sketch to work. Any ideas?

You can't define a variable inside a switch statement. Define that int outside first and then assign it a value inside the switch.