Skip to main content
. 2023 Sep 5;23(18):7670. doi: 10.3390/s23187670
Algorithm 1 Distributed LED brightness control algorithm
  • 1:

    Initialize θi=0 for i=1,,N, α=1, and desired error tolerance ϵ

  • 2:

    N: number of clients

  • 3:

    Initialize L^t,i according to user requirements, for i=1,,N

  • 4:

    #sensor calibration:

  • 5:

    For i=1,,N, sendθi=0 to client i

  • 6:

    For i=1,,N, receive Lt,i=0 from client i

  • 7:

    For i=1,,N, send θi=1 to client i

  • 8:

    For i=1,,N, receive Lt,i=Lmax,i from client i

  • 9:

    #LED brightness control:

  • 10:

    If a value Lt,i is received from a client i:

  • 11:

        While True:

  • 12:

            θi:=θiαJθiJθi

  • 13:

            If Jθi<ϵ:

  • 14:

                Break

  • 15:

        Send θi to client i

  • 16:

    Else

  • 17:

        Wait for Lt,i from a client i