I have attached a table showing the analysis of successive scans to determine the code for the electronic piano I am building. This relates to one piano note. The two switches are mechanically displaced to enable the velocity to be measured. This is not new information and is based on other peoples work.
Once the 1st switch is made and the Xor becomes 1 the counter is set to say 127. Until the 2nd switch is closed and the Xor changes to 0 the count is decremented on each scan. At this poin