We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No description provided.
The text was updated successfully, but these errors were encountered:
here are the two methods which tells us how to read the proximity sensors from the robot (from the TinyBit MakeCode extension repository)
//% blockId=Tinybit_Ultrasonic_Car block="ultrasonic return distance(cm)" //% color="#006400" //% weight=87 //% blockGap=10 //% name.fieldEditor="gridpicker" name.fieldOptions.columns=4 export function Ultrasonic_Car(): number { let list:Array<number> = [0, 0, 0, 0, 0]; for (let i = 0; i < 5; i++) { pins.setPull(DigitalPin.P16, PinPullMode.PullNone); pins.digitalWritePin(DigitalPin.P16, 0); control.waitMicros(2); pins.digitalWritePin(DigitalPin.P16, 1); control.waitMicros(15); pins.digitalWritePin(DigitalPin.P16, 0); let d = pins.pulseIn(DigitalPin.P15, PulseValue.High, 43200); list[i] = Math.floor(d / 40); } list.sort(); let length = (list[1] + list[2] + list[3])/3; return Math.floor(length); } //% blockId=Tinybit_Ultrasonic_CarV2 block="ultrasonic for V2 return distance(cm)" //% color="#006400" //% weight=87 //% blockGap=10 //% name.fieldEditor="gridpicker" name.fieldOptions.columns=4 export function Ultrasonic_CarV2(): number { pins.setPull(DigitalPin.P16, PinPullMode.PullNone); pins.digitalWritePin(DigitalPin.P16, 0); control.waitMicros(4); pins.digitalWritePin(DigitalPin.P16, 1); control.waitMicros(10); pins.digitalWritePin(DigitalPin.P16, 0); let d = pins.pulseIn(DigitalPin.P15, PulseValue.High, 500 * 58); return Math.floor(d / 58); }
I will need to test which methods works best. I am not sure if V2 refers to a version two of the method, or the hardware.
Sorry, something went wrong.
blainerothrock
No branches or pull requests
No description provided.
The text was updated successfully, but these errors were encountered: