treahuggs:
val= digitalRead(button); //Read input
if ((val==HIGH) && (oldval==LOW)){
Serial.write(0xFE); //command flag
Serial.write(192); //position
saveY=Yangle;
Serial.print(saveY);
delay(150);
} else
...
I assume this is intended to detect button transitions from unpressed to pressed, is that the idea? If so you would need to update oldval at some point to record that the switch is now pressed - and then update it again when it is released. I recommend separating the logic to detect button transitions from the code to deal with those transitions, this will eliminate the rather messy if/else if structure. I also recommend that you adopt the coding style of putting each { and } on separate lines with matching pairs indented by the same amount, it will make it much easier to visually check that the code structure matches what you intend.
treahuggs:
To everyone who assumes my code will not compile, you look really ignorant and rude right now as my code def compiles and will fully upload and run on my build.
It was not an assumption, it was a fact: the code you originally posted did not compile. Do you think that insulting the people trying to help you is going to encourage them to offer more help?