From a40bd2cb60d201aba5e0b9ab209b0a54896a2b07 Mon Sep 17 00:00:00 2001 From: "ELECFREAKS.Admin" Date: Sat, 5 Aug 2023 23:41:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20pxt.json,=20main.ts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.ts | 29 ++++++++++++++++------------- pxt.json | 3 ++- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/main.ts b/main.ts index 946d558..170151a 100644 --- a/main.ts +++ b/main.ts @@ -1082,29 +1082,31 @@ namespace CutebotPro { let orientation = 0 let cmd = 0 CutebotPro.pwmCruiseControl(0, 0) - if (turn == CutebotProTurn.Left){ + basic.pause(1000) + + if (angle == CutebotProAngle.Angle45) + tempangle = 150 + else if (angle == CutebotProAngle.Angle90) + tempangle = 316 + else if (angle == CutebotProAngle.Angle135) + tempangle = 450 + else + tempangle = 630 + + if (turn == CutebotProTurn.Left) { orientation = CutebotProWheel.RightWheel cmd = 0x04 } - else if (turn == CutebotProTurn.Right){ + else if (turn == CutebotProTurn.Right) { orientation = CutebotProWheel.LeftWheel cmd = 0x04 } - else{ + else { orientation = CutebotProWheel.AllWheel cmd = 23 + tempangle = tempangle + 5 } - if (angle == CutebotProAngle.Angle45) - tempangle = 148 - else if (angle == CutebotProAngle.Angle90) - tempangle = 296 - else if (angle == CutebotProAngle.Angle135) - tempangle = 442 - else - tempangle = 630 - - buf[0] = 0x99; buf[1] = cmd; buf[2] = orientation; @@ -1127,6 +1129,7 @@ namespace CutebotPro { } } + basic.pause(1000) /*let D_Value = 0 let I_Value = 0 let P_Value = 0 diff --git a/pxt.json b/pxt.json index 56a6e49..8b8a517 100644 --- a/pxt.json +++ b/pxt.json @@ -4,7 +4,8 @@ "description": "ELECFREAKS cutebotpro car", "license": "MIT", "dependencies": { - "core": "*" + "core": "*", + "neopixel": "github:elecfreaks/pxt-neopixel" }, "files": [ "README.md",