Actually I realise in reviewing this to explain it that I made an error earlier!

First of all visualise your data, It is a straight line as we only have two points.

ambient light = 280, brightness = 255

ambient light = 350, brightness = 51 (ie 20% of 255)

Plot it on a piece of paper.

Every straight line can be defined by the formula

y = (slope * x) + constant

so in this case

brightness = (slope * lux) + constant

Now the slope of the line is:

(51-255)/(350-280)

= -204/70

= -2.91 (I got -3.36 last time, don’t worry how, I just did, sorry bout dat)

To work out constant, take one of those points we know about and work it out. We’ll use the left hand point, lux = 280, brightness = 255

We know

brightness = (slope * lux) + constant

255 = (-2.91 * 280) + constant

255 = -814.8 + constant

so constant = 1069.8 (once again different to last time because of the wrong answer for slope)

Try it out for the other point, just to check:

lux = 350, brightness = 51

brightness = (-2.91 * lux) + 1069.8

51 should equal (-2.91*550) + 1069.8) (in fact it is .3 out because of rounding errors, but that is acceptable.

So in short

```
brightness = (-2.91 * lux) + 1069.8
```