Mega ANALOG INPUT resolution 255???

I'm playing around with some piezo transducers I purchased. For a quick immersion into it I uploaded the sketch from here.

The only change I made was the serial output from "knock" to the value. Shouldn't I be getting values from 100 (threshold) to 1023? I'm only getting values to 255. I did make one other change explicitly declaring pin 0 as an input since I understand output only has a resolution of 0-255.

If it makes any difference, this is an Arduino Mega1280. I get the same result on a Funduino Mega 2560

Thanks

That sketch, for some unknown reason, reads the result of analogRead into an eight bit variable, so it isn't surprising you only get 0...255

If what AWOL said isn't clear, change "byte val" to "int val" at the start - that declares val as an int which can store numbers above 255.

Oh duh.

Didn't notice the byte declaration... that should do it.

Thanks!