microsoft / jacdac

Device and service catalogs for Jacdac.
https://aka.ms/jacdac
Creative Commons Attribution 4.0 International
66 stars 25 forks source link

onConnect doesn't work (well, works in a strange way) #654

Closed tballmsft closed 3 years ago

tballmsft commented 3 years ago

See https://makecode.microbit.org/_RVeCwjgyUAmA

The onConnected handler doesn't run on start. Note that it does run when you press the A button. Then the second time you press the A button, the button hander runs. So, from a fresh state

modules.ledPixel1.onConnected(() => {
    modules.ledPixel1.setBrightness(85)
    modules.ledPixel1.setAll(0x00FF00)
})

input.onButtonPressed(Button.A, function() {
    modules.ledPixel1.setBrightness(85)
    modules.ledPixel1.setAll(0xFF0000)
})
pelikhan commented 3 years ago

Duplicate of https://github.com/microsoft/jacdac/issues/653