I am writing a code for Arduino. What it should do is:
It has to Monitor 6 analog inputs and if there is any activity on any of them, send (number of active pin + value on its pin) via serial connection.
On the other side of the serial connection, Other program will make decision on this given information.
How best to do it?
One solution might be like this:
}
AD converter is storing 10 bits values. Maximum value by AD converter is 1023 ([2^10-1]). Module for serial communication is sending bytes of data, so you need scale 1023 to 255. Equation is (255/1023)*currentAnalogValue (so it is 0.249266*currentAnalogValue). In your computer application, you need inverse equation 1023/255*receivedByte to receive original value.