doraemon WROTE:oh...the
#define CHANNEL1 0b10001001
#define CHANNEL2 0b10001001
is just to define the analog channel for ultarsonic sensor and analog, u no need to change that,
what i mean by "you may just assign the return value of the function for reading analog sensor and ultrasonic sensor to different variable" is, if you read through the source code, you will found that there is a function, us_value(unsigned char mode) for you to read value from ultrasonic sensor, you may assign a variable, for example:
unsigned int ultrasonicValue; //define variable
ultrasonicValue = us_value(1); //assign ultrasonic value to the variable
to read adc value for ultrasonic sensor.
while for analog, u may just get the value like this:
unsigned int analogSensorValue; //define variable
analogSensorValue=read_adc(CHANNEL1); //assign analog value to the variable
hope this help..
Thank you doraemon for the tips~
It helped me a lot~ Huhuhu~