hello, i am using arduino uno...... i know that build in arduino uno gives 10 bit serial digital data for particular analog input.... is it possible to get 8 bit serial data instead of getting 10 bit data?? if yes then how??? anyway ARDUINO ANALOGREAD RESOLUTION command is not for arduino uno board......thank u...
You're using "serial" incorrectly here, as far as I can tell. Serial refers to the transfer of data one bit at a time. Without qualification, it refers to UART/TTL serial, which is what you're using when you do Serial.print() and so on.
The value returned from analogRead() (on the Uno and any other AVR-based arduino) is a 10 bit value. The word "serial" is not appropriate to describe it.
What are you trying to do?
If you need to take lots of samples very quickly, that's a good reason to lower the resolution - to do this you need to directly manipulate the registers (see the datasheet) - this is outside the realm of normal Arduino stuff, and I've never seen a library for it (usually when you need to do this, the project is such that a library won't give you the flexibility you need)
If you just need to convert the 10-bit value into an 8-bit value because you're, say, controlling something (maybe pwm with analogWrite()), you can just divide it by 4, or rightshift it 2. If you need more complex mapping, you can use the map() function supplied by Arduino.
If you want to convert the 10-bit value from analogRead() to an 8-bit value just do
int analogTenBit = analogRead(analogPin); byte analogEightBit = analogTenBit >> 2; // this shifts the value 2 bits to the right
thanks a lot both of u... actually i am trying to send digital serial data using laser... for this purpose i use a micro-phone then amplified the microphone signal and i choose 4.2v peak to peak analog microphone voice signal.... and this analog signal i am giving to the INPUT OF ARDUINO ANALOG PIN A0 for getting corresponding digital bit.... i want to choose 8 bit resolution,cause 8 bit is enough for my task and it's standard also.....