I’m doing a project using the k8055 board connecting to a sensor.
the sensor give an analog data (showing from the board demo program).
The data = a value increase/decrease depends on the distance.
the problem: how do i take/extract that data & use it for my program?
C++ solution
When you connect to analog inputs A1 A2 try this
Remeber to take jumper SK2 and 3 off otherwise they are internal and you are external.
for input A1
int value1;
value1 = ReadAnalogChannel(1); //Reads the value from the input and stores in int value
OutputAnalogChannel(1, value1); //Puts the read value out on analog led PWM1
cout << value1 << endl;
for input A2
int value2;
value2 = ReadAnalogChannel(2); //Reads the value from the input and stores in int value
OutputAnalogChannel(2, value2); //Puts the read value out on analog led PWM2
cout << value2 << endl; //Writes the value on the screen
Bare in mind this is only an idea I havent tried this. Good luck
[quote=“systa77”]C++ solution
When you connect to analog inputs A1 A2 try this
Remeber to take jumper SK2 and 3 off otherwise they are internal and you are external.
for input A1
int value1;
value1 = ReadAnalogChannel(1); //Reads the value from the input and stores in int value
OutputAnalogChannel(1, value1); //Puts the read value out on analog led PWM1
cout << value1 << endl;
for input A2
int value2;
value2 = ReadAnalogChannel(2); //Reads the value from the input and stores in int value
OutputAnalogChannel(2, value2); //Puts the read value out on analog led PWM2
cout << value2 << endl; //Writes the value on the screen
Bare in mind this is only an idea I havent tried this. Good luck [/quote]
Thank you for giving me the idea. I will try it out.