# Microbit LED's won't turn on with my code, or if statement dosen't work as needed

**URL:** <https://forum.makecode.com/t/microbit-leds-wont-turn-on-with-my-code-or-if-statement-dosent-work-as-needed/26121>\
**Category:** micro:bit\
**Created:** [January 19, 2024, 7:21pm UTC](https://forum.makecode.com/t/microbit-leds-wont-turn-on-with-my-code-or-if-statement-dosent-work-as-needed/26121 "2024-01-19T19:21:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ExternalWRD](https://avatars.discourse-cdn.com/v4/letter/e/f9ae1b/32.png) [@ExternalWRD](https://forum.makecode.com/u/ExternalWRD)\
**Post date:** [January 19, 2024, 7:21pm UTC](https://forum.makecode.com/t/microbit-leds-wont-turn-on-with-my-code-or-if-statement-dosent-work-as-needed/26121/1 "2024-01-19T19:21:07Z")

</div>

My code wont work. I’m trying to make it so that how big of a light level will display on the led. The smallest value is [0,0] in the leds, so when there is no light I want the [0,0] led to show up, then it goes up progressing.  
I used Python.

```auto
Old_Plot = [0,0]

PlotX = Old_Plot[0]
PlotY = Old_Plot[1]

def Functionality():
    global PlotX, PlotY, Old_Plot
    reading = input.light_level()
    final_reading = Math.round(abs(reading / 25) * 2.5) # Nei, dette er ikke fra google, abs står får "Absolute Value" det gjør negative tall om til positive, so eks: -3 blir til 3
    
    if not final_reading == 0:
        final_reading -= 1 # Fordi datamaskiner starter alltid på 0

    if final_reading > 25:
        final_reading = 25

    # print(str(final_reading))

    PlotX = final_reading / 5
    
    if PlotX >= (PlotY * 5) + 1:
        PlotY += 1
        PlotX = 0
    print(PlotX)
    print(PlotY)

    led.unplot(Old_Plot[0], Old_Plot[1])
    led.plot(PlotX, PlotY)
    Old_Plot = [PlotX,PlotY]
    

while True:
    Functionality()

```

---

<div class="post-metadata">

**Author:** ![robotosaurus](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/robotosaurus/32/19294_2.png) [@robotosaurus](https://forum.makecode.com/u/robotosaurus)\
**Post date:** [January 19, 2024, 9:13pm UTC](https://forum.makecode.com/t/microbit-leds-wont-turn-on-with-my-code-or-if-statement-dosent-work-as-needed/26121/2 "2024-01-19T21:13:09Z")

</div>

Microbit’s use 0 to 4 not 1 to 5. because computers like 0
