fix avoid_IR
This commit is contained in:
parent
772f701daa
commit
ec0be625ed
4
main.ts
4
main.ts
|
|
@ -934,10 +934,12 @@ namespace mbit_Robot {
|
||||||
export function Avoid_Sensor(value: enAvoidState): boolean {
|
export function Avoid_Sensor(value: enAvoidState): boolean {
|
||||||
|
|
||||||
let temp: boolean = false;
|
let temp: boolean = false;
|
||||||
|
pins.setPull(DigitalPin.P9, PinPullMode.PullUp)
|
||||||
pins.digitalWritePin(DigitalPin.P9, 0);
|
pins.digitalWritePin(DigitalPin.P9, 0);
|
||||||
control.waitMicros(10);
|
control.waitMicros(100);
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case enAvoidState.OBSTACLE: {
|
case enAvoidState.OBSTACLE: {
|
||||||
|
serial.writeNumber(pins.analogReadPin(AnalogPin.P3))
|
||||||
if (pins.analogReadPin(AnalogPin.P3) < 800) {
|
if (pins.analogReadPin(AnalogPin.P3) < 800) {
|
||||||
|
|
||||||
temp = true;
|
temp = true;
|
||||||
|
|
|
||||||
4
pxt.json
4
pxt.json
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "mbit",
|
"name": "mbit",
|
||||||
"version": "3.0.4",
|
"version": "3.0.5",
|
||||||
"description": "Extension for YahBoom m:bit V3.0.4",
|
"description": "Extension for YahBoom m:bit V3.0.5",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"core": "*",
|
"core": "*",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue