/* reads out a lcd display based on: https://lowpowerlab.com/forum/projects/moteino-kitchen-scale/ An Arduino Pro Micro was used first as a simple logic analyser, to find the common pins and the segment pins. See the other sketch. Later the same arduino was put with this sketch inside the scale to provide serial output via usb. This paricular display is part of a transtek kitchen scale (pcb label: tsk759) The connector in numbered like this ----top border of the board---- 0 2 4 6 8 10 12 14 1 3 5 7 9 11 13 15 Pins 0 to 3 are the common pins, but since they are phase shifted by 90° only one is needed. Only Pins 8 to 15 carry useful information. All others are ignored. */ byte samples[2][56]; // lcd mapping int seg1[2] = { PINB2, PINB6 }; int seg2[2] = { PINB4, PINB3 }; int seg3[2] = { PINB2, PINB6 }; int seg4[2] = { PINB2, PINB6 }; void setup() { Serial.begin(115200); } void loop() { get_samples(); // reads out the registers if (Serial.read() > 0) { int pulse = get_pulse(); //print_segments(pulse); print_4digit(pulse); print_3digit(pulse); print_digit(pulse, seg2); print_digit(pulse, seg1); Serial.println(); } } void get_samples() { int f=0; while (f<56) { samples[0][f] = PINB; samples[1][f] = PIND; delayMicroseconds(333); // = 1/3 ms. three samples in 1ms, which is the approximate pulse width. f++; } } // try to find the position, where the control signal triggers // looking for a sequence of more than four ones seams sufficient int get_pulse() { int n = 0; int f = 0; while (f<30) { if ((samples[1][f]& (1 << PIND3))) { n++; if (n>4) break; } else n=0; f++; } return f - 3; // sets the index in the first 1ms of the trigger event } void print_digit(int start, int seg[]) { byte digit = InterpretSevenSegmentSet( samples[0][start + 18]&(1<