A Problem With the Version
Depending on when you purchased your official Raspberry Pi display, you either own
Version 1.0 or
Judging from the specific nature of your error (values < 128 are off and >=128 are on), I am almost entirely certain the problem you're facing is that you own the
Version 1.0 model of the official Raspberry Pi display. That version does not support brightness control - it only turns the display on or off. To summarize brightness control between
Version 1.0 and
Version 1.0: Setting the brightness, or
n, to anything between 0-127 is "off" and anything between 128-255 is "on".
Version 1.1: Brightness adjustment works properly between 25-255, as you would expect. A word of warning: "Unless you have a remote connection to your Pi, or really know what you're doing then don't set the backlight brightness below 20 or turn the power off. It's not easy to type when you can't see!" - Phil Howard, a Pimoroni Forum moderator
As far as I know, this was a fix that the team designing the official Raspberry Pi display implemented at
Version 1.1. This is the simplest reason I have to explain why brightness control is not available in
Version 1.0 but available in
Beyond just my personal experience with the product, I tried looking around for some official documentation to support my answer. All I could find was some relevant discussion of this bug in the official Raspberry Pi Forums.
Checking Which Version You Own
The words "Raspberry PI Display V1.0" or "Raspberry PI Display V1.1" are printed right next the Raspberry Pi logo on the display.
Version 1.0 for Adjustable Brightness
Unfortunately, I could not find any legitimate foolhardy approaches to making the brightness adjustable beyond the binary "on" / "off" that is implemented in
The best solution is to purchase a new Raspberry Pi display module: the ones on sale are >=