Society of Robots - Robot Forum
Software => Software => Topic started by: piravlos on November 01, 2010, 09:01:51 PM
-
hello
i want to read and save the data from a sharp ir which is connected to the microcontroller. how can i do that?
thanks
-
Connect the Sharp to an analog input pin. Write code to set-up the ADC for that pin, do an ADC conversion, read the ADC data and save it.
This is all we can tell you with out knowing more.
Which microcontroller?
Where do you want the data saved?
There are also many threads here that discuss using the Sharp sensors. A search will bring up lots of info and even code examples.
-
hello thanks for the reply.
i want to save the data in an array.
my problem is that i do not know how to start. how do i set up the ADC and do the conversion?
thanks
-
Learn the C programming language, putting data into arrays is common.
-
void SetChanADC(){ OpenADC(ADC_FOSC_RC & ADC_RIGHT_JUST & ADC_0_TAD,
ADC_CH7& ADC_INT_OFF & ADC_VREFPLUS_VDD & ADC_VREFMINUS_VSS, 15 );
}
void configure_ADC() {
OpenADC(ADC_FOSC_RC & ADC_RIGHT_JUST & ADC_0_TAD,
ADC_CH7& ADC_INT_OFF & ADC_VREFPLUS_VDD & ADC_VREFMINUS_VSS, 15);
}
is something wrong here?
thanks