Skip to main content

Posts

Showing posts with the label buggy

kitronik :Move buggy (Python controlled servos)

In a previous post I looked at controlling the Kitronik :Move buggy using Javascript based blocks . In this short post I will show  controlling the servos of the micro:bit based :Move buggy with Python. Control is via pin1(left motor) and pin2 (right motor) and the motors have to be driven in opposite directions to move forward or backwards. The direction of the motors is controlled by the analogue value written to the pins;   pinX.write_analog(180) - anticlockwise or  pinX.write_analog(1) - clockwise ( pinX.write_analog(0) - stops the motor). Setting the analog_period seems to work at 20ms; this was found by experiment, discussed in a previous post . So the initial code below sets up the moves for forward, backward, turn left, turn right all controlled with a move for so many milliseconds. Code  from microbit import * pin1.set_analog_period(20) pin2.set_analog_period(20) def forward(N):     pin1.write_analog(180...

kitronik :Move mini buggy (JavaScript blocks)

Finally got around to building add playing with the Kitronik :Move  https://www.kitronik.co.uk/5624-move-mini-buggy-kit-excl-microbit.html  (see below - I decided to put the green sides on the outside - just to be different). One of its features is a vertical set of holes for a pen to be placed in. Add the blocks (found at  https://github.com/KitronikLtd/pxt-kitronik-servo-lite ) in blocks editor ( https://makecode.microbit.org/ )  to control the motors. You can do the same thing with writing to the pins,  t hose instructions come with the build instructions, but using the extra blocks  is a little easier to understand. Also add the package for neopixels (type in neopixels  in the search box to find them). Two very good tutorials I found useful to start with can be found at: Neopixels on the robot  in blocks - https://www.kitronik.co.uk/blog/using-kitronik-zip-leds-bbc-microbit/ Servos on the robot in blocks -  ht...