Memsic 2125 code

Hi everyone,
I have some coding skills but I'm having a lot of trouble writing a code that allows me to tilt my memsic accelerometer and have it dim and brighten an led. Would anyone mind writing/helping me with this one!

I have some so far I am trying just for it to turn on and of can anyone tweak this?

void setup() {
  pinMode(0, INPUT);
  pinMode(1, INPUT);
  pinMode(2, OUTPUT);

void loop() {
  int xvalue = analogRead(0);
  int yvalue = analogRead(1); 
  Serial.print ("x: ");
  Serial.print (" | y: ");
  Serial.print (yvalue);
  if (yvalue==1023)
    digitalWrite (2,HIGH);

moderator: added code tags and indented the code (use CTRL-T in the IDE)

for dimming and brightening a LED you should use analogWrite(p); // parameter p = 0..255
This is known as PWM = Pulse Width Modulation.