Help for getting some values from FOR function

Hello, guys
I am a new one for Arduino. I want to Serial.print out some values in the loop like 45,46,47,48, but I got many zeros and a data. Is that wrong about the function getpixel or the way I used the RETURN in GETPIXEL function? Thank you so much.

#include <Servo.h>
const int ao = A0;
const int si = 4;
const int clk = 5;
int val;
int angle =90;
int pixel[128];
int i;
int avgdata;
int avgdata1;
int avgdata2;
int x;
int a;
Servo myservo;
void setup() {
Serial.begin(115200);
pinMode(clk, OUTPUT);
pinMode(si, OUTPUT);
myservo.attach(9);
}

void loop() {

avgdata1= getpixel(x);

Serial.println(avgdata1);
//Serial.print(’,’);
}

int getpixel(int avgdata2) {

for (int i=0; i<128; i++) {
if(i==0) {
digitalWrite (si, HIGH);
}

analogWrite (clk,255);
digitalWrite (clk, HIGH);
delayMicroseconds (5);

if (i == 0) {
digitalWrite( si, LOW);
}
delayMicroseconds(150);
digitalWrite (clk, LOW);

if (i == 0){
//Serial.println();
}
pixel = analogRead(ao);

_ if(pixel*>210) {*_
avgdata2 = i;
return avgdata2;

* }*
* //Serial.print(val);*
* //Serial.print(’,’);*

* }*

* }*
[/quote]

You the code tag not the quote tag when posting code, it is the one to the left of the quote tag.

What is this?

 analogWrite (clk,255);
    digitalWrite (clk, HIGH);

Assuming that clk is a PWM capable pin those two lines do the same thing.

but I got many zeros and a data.

What does that mean? Can you post a short piece of what you got.

Have you set the monitor to 115200 baud?

What is this wired up to?

What is the return value of your function if “pixel” <= 210?