Seeed-Studio / pxt-grove

A Microsoft MakeCode package for Seeed Studio Grove module
https://makecode.microbit.org/pkg/seeed-studio/pxt-grove
MIT License
36 stars 48 forks source link

Simulator Error: Failed cast on undefined #8

Closed microbit-sam closed 5 years ago

microbit-sam commented 5 years ago

A customer has reported an error when they attempt to use the Grove MakeCode extension

pxtapp.js:24988 sim error: failed cast on undefined
   at init (pxt_modules/Grove/main.ts:220:9)
   at onGesture (pxt_modules/Grove/main.ts:79:5)
   at <main> (pxt_modules/Grove/main.ts:1:1)

The MakeCode code is as follows:

grove.onGesture(GroveGesture.Right, function () {
    basic.showString("R")
})
grove.onGesture(GroveGesture.Wave, function () {
    basic.showString("W")
})
grove.onGesture(GroveGesture.Up, function () {
    basic.showString("U")
})
grove.onGesture(GroveGesture.Down, function () {
    basic.showString("D")
})
grove.onGesture(GroveGesture.Left, function () {
    basic.showString("L")
})
grove.onGesture(GroveGesture.Anticlockwise, function () {
    basic.showString("A")
})
grove.onGesture(GroveGesture.Forward, function () {
    basic.showString("F")
})
grove.onGesture(GroveGesture.Backward, function () {
    basic.showString("B")
})
grove.onGesture(GroveGesture.Clockwise, function () {
    basic.showString("C")
})
basic.showIcon(IconNames.Yes)
basic.forever(function () {

})
microbit-sam commented 5 years ago

Duplicate of my own issue #9