Skip to content

Commit

Permalink
Merge pull request #35 from MKleinSB/master
Browse files Browse the repository at this point in the history
change target to microbit, remove Calliope mini specific pins
  • Loading branch information
Lesords authored Dec 18, 2024
2 parents 39b14d5 + 52a9f86 commit 8d0a817
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
15 changes: 8 additions & 7 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ namespace grove {
//% blockId=grove_ultrasonic_centimeters_v2 block="(V2)Ultrasonic Sensor (in cm) at|%pin"
//% pin.fieldEditor="gridpicker" pin.fieldOptions.columns=4
//% pin.fieldOptions.tooltips="false" pin.fieldOptions.width="250"
//% group="Ultrasonic" pin.defl=DigitalPin.C16
//% group="Ultrasonic" pin.defl=DigitalPin.P0

export function measureInCentimetersV2(pin: DigitalPin): number
{
Expand Down Expand Up @@ -491,7 +491,7 @@ namespace grove {
//% blockId=grove_ultrasonic_inches_v2 block="(V2)Ultrasonic Sensor (in inch) at|%pin"
//% pin.fieldEditor="gridpicker" pin.fieldOptions.columns=4
//% pin.fieldOptions.tooltips="false" pin.fieldOptions.width="250"
//% group="Ultrasonic" pin.defl=DigitalPin.C16
//% group="Ultrasonic" pin.defl=DigitalPin.P0
export function measureInInchesV2(pin: DigitalPin): number
{
let duration = 0;
Expand Down Expand Up @@ -521,7 +521,7 @@ namespace grove {
//% blockId=grove_ultrasonic_centimeters block="Ultrasonic Sensor (in cm) at|%pin"
//% pin.fieldEditor="gridpicker" pin.fieldOptions.columns=4
//% pin.fieldOptions.tooltips="false" pin.fieldOptions.width="250"
//% group="Ultrasonic" pin.defl=DigitalPin.C16
//% group="Ultrasonic" pin.defl=DigitalPin.P0

export function measureInCentimeters(pin: DigitalPin): number
{
Expand Down Expand Up @@ -552,7 +552,7 @@ namespace grove {
//% blockId=grove_ultrasonic_inches block="Ultrasonic Sensor (in inch) at|%pin"
//% pin.fieldEditor="gridpicker" pin.fieldOptions.columns=4
//% pin.fieldOptions.tooltips="false" pin.fieldOptions.width="250"
//% group="Ultrasonic" pin.defl=DigitalPin.C16
//% group="Ultrasonic" pin.defl=DigitalPin.P0
export function measureInInches(pin: DigitalPin): number
{
let duration = 0;
Expand Down Expand Up @@ -585,7 +585,7 @@ namespace grove {
//% group="4-Digit"
//% clkPin.fieldOptions.tooltips="false" clkPin.fieldOptions.width="250"
//% dataPin.fieldEditor="gridpicker" dataPin.fieldOptions.columns=4
//% clkPin.defl=DigitalPin.C16 dataPin.defl=DigitalPin.C17
//% clkPin.defl=DigitalPin.P0 dataPin.defl=DigitalPin.P1
//% dataPin.fieldOptions.tooltips="false" dataPin.fieldOptions.width="250"
//% blockSetVariable=4digit
export function createDisplay(clkPin: DigitalPin, dataPin: DigitalPin): TM1637
Expand Down Expand Up @@ -628,7 +628,7 @@ namespace grove {
*
*/
//% blockId=grove_getjoystick block="get joystick key at|%xpin|and|%ypin"
//% group="Thumbjoystick" xpin.defl=AnalogPin.C16 ypin.defl=AnalogPin.C17
//% group="Thumbjoystick" xpin.defl=AnalogPin.P0 ypin.defl=AnalogPin.P1
export function getJoystick(xpin: AnalogPin, ypin: AnalogPin): number {
return joystick.joyread(xpin, ypin);
}
Expand Down Expand Up @@ -683,7 +683,7 @@ namespace grove {
* @param handler code to run
*/
//% blockId=grove_joystick_create_event block="on Key|%key at |%xpin|and|%ypin"
//% group="Thumbjoystick" xpin.defl=AnalogPin.C16 ypin.defl=AnalogPin.C17
//% group="Thumbjoystick" xpin.defl=AnalogPin.P0 ypin.defl=AnalogPin.P1

export function onJoystick(key: GroveJoystickKey, xpin: AnalogPin, ypin: AnalogPin, handler: () => void) {
control.onEvent(joystickEventID, key, handler);
Expand Down Expand Up @@ -866,3 +866,4 @@ namespace grove {
serial.writeString(cmd + "\u000D\u000A")
}
}

13 changes: 9 additions & 4 deletions pxt.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Grove",
"version": "0.6.0",
"version": "0.7.0",
"description": "A Microsoft MakeCode package for Seeed Studio Grove module",
"license": "MIT",
"dependencies": {
Expand All @@ -19,8 +19,13 @@
"test.ts"
],
"public": true,
"supportedTargets": [
"calliopemini"
],
"targetVersions": {
"target": "7.0.51",
"targetId": "microbit"
},
"supportedTargets": [
"calliopemini",
"microbit"
],
"preferredEditor": "tsprj"
}
4 changes: 2 additions & 2 deletions test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
let _4Digit = grove.createDisplay(DigitalPin.C16, DigitalPin.C17)
let _4Digit = grove.createDisplay(DigitalPin.P0, DigitalPin.P1)
grove.setupWifi(
SerialPin.P15,
SerialPin.P1,
Expand All @@ -9,4 +9,4 @@ grove.setupWifi(

basic.forever(function () {
_4Digit.bit(6, 1)
})
})

0 comments on commit 8d0a817

Please sign in to comment.