RoboticsGeneral

Maqueen robot Makecode block request

userHead evandevon 2019-05-26 19:03:54 7940 Views4 Replies
Hi,
I'm experimenting with the Maqueen robot and would like to ask either for instructions on turning off the serial output of the distance sensor, which seems to be automatically sent over serial by default.
Preferably I'd like this feature to be enabled/disabled by a block or not on at all, which would allow the user to fairly easily use the existing Makecode serial blocks to send the data.
I currently have a variety of projects that have data being sent over serial (e.g. temperature and humidity logging) and I'd like to connect the sensors to the robot and then transmit data over serial to a spreadsheet - but the serial port is being swamped with the distance sensor measurements.

The line I think that needs removing/modifying...
Code: Select all
// read pulse
        let d = pins.pulseIn(DigitalPin.P2, PulseValue.High, maxCmDistance * 42);
        console.log("Distance: " + d/42);
Any advice?
Thanks,
Evan
2019-05-29 21:23:15 Thanks Nana,
I can use another Makcode extension designed for taking sonar sensor readings https://makecode.microbit.org/pkg/microsoft/pxt-sonar but it seems to crash the program when I try to upload the hex file to the Micro:Bit (if I also install the Maqueen extension so I can access the motors). I've made a fork of the Github project and commented out that line (https://github.com/evandevon/maqueen/) - seems to work in Makecode now. This is my first time using Github so I hope I followed the correct procedure and haven't offended anybody.

Thanks for your time and advice,
Ev
userHeadPic evandevon
2019-05-29 08:07:06 Thanks for your response,
Trying to attach images or other files results in an error so here's a link to the files.
https://1drv.ms/u/s!AqeCPpkT_M3AhotG2CgJFHaB2f56Ug
I've included two screenshots from Makecode. One showing the code I used and the other showing the serial output (as referenced in the previous message). There's also a hex file of which the code screenshot was taken in case it is useful - However it just seems like that code I referenced in the previous message is designed to always send the current distance measurement over serial as "Distance: <value> " , and appears to happen whenever the distance measurement is taken, regardless of the code I use.

Thanks for your assistance!
Ev
userHeadPic evandevon