Switch/Case function with tilt switch and RGB

Need more info on your tilt sensor, specifically on how it works and how it is wired.

Also: what does your code actually do, and how does this differ from what you expect/want it to do?