# Code works in simulator but not on actual Micro:bit

**URL:** https://forum.makecode.com/t/code-works-in-simulator-but-not-on-actual-micro-bit/21994
**Category:** micro:bit
**Created:** [August 21, 2023, 5:16pm UTC](https://forum.makecode.com/t/code-works-in-simulator-but-not-on-actual-micro-bit/21994 "2023-08-21T17:16:26Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![cmmorgan](https://avatars.discourse-cdn.com/v4/letter/c/90ced4/32.png) [@cmmorgan](https://forum.makecode.com/u/cmmorgan)
#### Post date: [August 21, 2023, 5:16pm UTC](https://forum.makecode.com/t/code-works-in-simulator-but-not-on-actual-micro-bit/21994/1 "2023-08-21T17:16:26Z")

</div>

I have a bit of code that increments a variable each time pin 0 is touched. After incrementing, it scrolls the new value of the variable across the LEDs. Funny thing is, it works great on the simulator, but doesn’t work at all on the Micro:bit controller.

# Touches

from microbit import \*  
touches = 0

while True:  
if pin0.is\_touched():  
touches += 1  
display.scroll(str(touches))

---

<div class="post-metadata">

### Author: ![bsiever](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/bsiever/32/1032_2.png) [@bsiever](https://forum.makecode.com/u/bsiever)
#### Post date: [August 22, 2023, 4:30pm UTC](https://forum.makecode.com/t/code-works-in-simulator-but-not-on-actual-micro-bit/21994/2 "2023-08-22T16:30:29Z")

</div>

I think you need to set the “touch mode” to capacitive. See: [https://support.microbit.org/support/solutions/articles/19000116318-touch-sensing-on-the-micro-bit](https://support.microbit.org/support/solutions/articles/19000116318-touch-sensing-on-the-micro-bit) .

The default “touch mode” for pins is resistive mode. Resistive mode may work ok if you touch the input pin while also touching the ground pin.

Bill
