Convert Analog(0-3.3V) Input(Ch2; Ch3) to Digital(0/3.3V, Active-High) Output(P1_3, GPIO0[10]; P1_4, GPIO0[11]) on LPCXpresso43xx Development Board, also send Digitized Analog Input to Analog Output(Ch0; Ch1). Relay Digital Input(P1_5, GPIO1[8]) to Output(P1_6, GPIO1[9]).
In the 5 seconds period after board power up or reset, threshold will be auto-adjusted according to the range of the analog input(Noise Margin: 30% of data range. Check photodiode polarity, make sure input in maximum range, tested on OSRAM BPW21 and OSRAM SFH2440), then digital output will be triggered using learned threshold.