Does anybody have any clue how to control the bi-color LED of ACR122U via the method Reader.control()
on Android? (library acssmc-1.1.3).
I am reading the API and have no idea what the command description means:
Example:
byte[] command = {(byte) 0xFF, (byte) 0x00, (byte) 0x40, (byte) 0b01110111, (byte) 0x04, (byte) 20, (byte) 30, (byte) 3, (byte) 2};
These things I do not understand:
Some explained examples would be awesome.
The command to change the LED state is
+------+------+------+------+------+------+------+------+------+ | CLA | INS | P1 | P2 | Lc | DATA | +------+------+------+------+------+------+------+------+------+ | 0xFF | 0x00 | 0x40 | SC | 0x04 | T1 | T2 | #R | 0x00 | +------+------+------+------+------+------+------+------+------+
where SC defines the state of the LEDs (continuously on/off, blinking), T1/T2 define the blinking wave form, and #R defines the number of repetitions of the blinking wave form.
So the main parameter to define how the LEDs should blink and how they should look after blinking finished is SC. This is a field of 8 bits:
So lets assume that you set bits 4 and 6 of SC (and clear the rest), i.e. SC = 0x50. Further, you set T1 = 5 (0x05), T2 = 10 (0x0A), and #R = 2 (0x02). Thus, you have the following command:
+------+------+------+------+------+------+------+------+------+ | 0xFF | 0x00 | 0x40 | 0x50 | 0x04 | 0x05 | 0x0A | 0x02 | 0x00 | +------+------+------+------+------+------+------+------+------+
Then the green LED will be off and the red LED will blink two times with the following wave form:
RED ON ----------\ /----------\ | | | RED OFF \--------------------/ \-------------------- \________/ \__________________/ \________/ \__________________/ T1 = 500ms T2 = 1000ms T1 = 500ms T2 = 1000ms \_____________________________/ \_____________________________/ Repetition 1 Repetition 2
Now, lets assume that you also want to blink the green LED, but with its initial state set to off (so that blinking switches between red and green instead of red and no light). Therefore, you also set bit 7 of SC, i.e. SC = 0xD0. Thus, you have the following command:
+------+------+------+------+------+------+------+------+------+ | 0xFF | 0x00 | 0x40 | 0xD0 | 0x04 | 0x05 | 0x0A | 0x02 | 0x00 | +------+------+------+------+------+------+------+------+------+
Then the red LED and the green LED will alternately blink two times with the following wave form:
RED ON ----------\ /----------\ | | | RED OFF \--------------------/ \-------------------- GREEN ON /--------------------\ /-------------------- | | | GREEN OFF ----------/ \----------/ \________/ \__________________/ \________/ \__________________/ T1 = 500ms T2 = 1000ms T1 = 500ms T2 = 1000ms \_____________________________/ \_____________________________/ Repetition 1 Repetition 2
Now, lets assume that after blinking finished, you want the red LED to be continuously on and the green LED to be continuously off. You therefore need to set bits 2 and 3 in order to be able to define a final state of the two LEDs. (If you do not set those bits, then the values of bits 0 and 1 will simply be ignored.) You then want to define a final state of red on (bit 0 = 1) and gree off (bit 1 = 0). Consequently, you get SC = 0xDD. Thus, you have the following command:
+------+------+------+------+------+------+------+------+------+ | 0xFF | 0x00 | 0x40 | 0xDD | 0x04 | 0x05 | 0x0A | 0x02 | 0x00 | +------+------+------+------+------+------+------+------+------+
Then the red LED and the green LED will alternately blink two times, the red LED will be turned on after blinking, and the green LED will be turned off. You get the following wave form:
RED ON ----------\ /----------\ /--------------... | | | | RED OFF \--------------------/ \--------------------/ GREEN ON /--------------------\ /--------------------\ | | | | GREEN OFF ----------/ \----------/ \--------------... \________/ \__________________/ \________/ \__________________/ T1 = 500ms T2 = 1000ms T1 = 500ms T2 = 1000ms \_____________________________/ \_____________________________/ \_____________... Repetition 1 Repetition 2 Final state
Finally, you want to reduce the number of repetitions to 1 (#R = 0x01) and you want to invert the high and low phases of the blinking wave form (T1 = 0x0A and T2 = 0x05). Thus, you have the following command:
+------+------+------+------+------+------+------+------+------+ | 0xFF | 0x00 | 0x40 | 0xDD | 0x04 | 0x0A | 0x05 | 0x01 | 0x00 | +------+------+------+------+------+------+------+------+------+
You get the following wave form:
RED ON --------------------\ /--------------... | | RED OFF \----------/ GREEN ON /----------\ | | GREEN OFF --------------------/ \--------------... \__________________/ \________/ T1 = 1000ms T2 = 500ms \_____________________________/ \_____________... Repetition 1 Final state