2nd Servo · arm or sweep extension
A second hobby servo on free pin P15
(use P16 if P15 is already taken). Lets you drive a gripper, lift arm, or pan turret
alongside the built-in head servo.
Schematic
How to wire
- Power off the robot. Plug servo red → 3V3, brown/black → GND.
- Plug the servo signal (orange/yellow) into the P15 Gravity port (yellow row).
- Switch the robot back on. Use servo write pin P15 to angle in MakeCode.
MakeCode (TypeScript)
// Sweep a 2nd servo connected to P15 (0° → 180° → 0°)
input.onButtonPressed(Button.A, function () {
for (let a = 0; a <= 180; a += 10) {
pins.servoWritePin(AnalogPin.P15, a)
basic.pause(40)
}
for (let a = 180; a >= 0; a -= 10) {
pins.servoWritePin(AnalogPin.P15, a)
basic.pause(40)
}
})
// Centre on start
pins.servoWritePin(AnalogPin.P15, 90)
Test it · Status
OLED Display · 0.96" SSD1306
Tiny 128×64 white-on-black screen on the I²C bus
(default address
0x3C). Great for showing distance, speed, scores
or robot dialogue.Schematic
How to wire
- Plug a 4-pin Gravity I²C cable into the Maqueen's I²C port (matches SDA/SCL/3V3/GND).
- Plug the other end into the SSD1306 OLED — colour pairs match.
- Add the OLED-SSD1306 extension in MakeCode and
call
OLED.init(128, 64)before drawing.
MakeCode (TypeScript)
// Requires extension: OLED-SSD1306 (search this name in MakeCode)
OLED.init(128, 64)
OLED.clear()
OLED.writeStringNewLine("Hello,")
OLED.writeStringNewLine("Maqueen!")
input.onButtonPressed(Button.A, function () {
OLED.clear()
OLED.writeStringNewLine("A pressed")
OLED.writeNumNewLine(input.runningTime())
})
Test it · Status
Gas Sensor · DFRobot SEN0465 / MQ-2
Analogue gas sensor for smoke / LPG / CO style detection.
Reads on P1 as a 0–1023 value. Higher = more gas.
(The SEN0465 also offers an I²C variant — same plug into the I²C port.)
Schematic
How to wire
- Plug a Gravity 3-pin cable: red → 3V3, black → GND, blue/yellow → P1.
- Pre-heat the sensor for ~30 s on first power-up — readings drift until the heater stabilises.
- Use
pins.analogReadPin(AnalogPin.P1)and pick a threshold (try 400–600) to fire your alarm.
MakeCode (TypeScript)
// Read gas sensor on P1, alarm when value > 500
let threshold = 500
basic.forever(function () {
let g = pins.analogReadPin(AnalogPin.P1)
serial.writeLine("GAS:" + g)
if (g > threshold) {
basic.showIcon(IconNames.Skull)
music.playTone(Note.C5, 150)
} else {
basic.showIcon(IconNames.Yes)
}
basic.pause(200)
})
Test it · Status
Color Sensor · TCS34725 RGB + Clear
Senses RGB + clear-channel light over I²C
(address
0x29). Has an on-board white LED for consistent illumination.
Use it for sorting, line colour ID or "what colour is this?" games.Schematic
How to wire
- Plug a Gravity 4-pin I²C cable from the Maqueen's I²C port to the TCS34725 breakout.
- Make sure the breakout's white LED faces the surface you're scanning, ~10–20 mm above it.
- Add the TCS34725 extension in MakeCode and call
tcs34725.start()once at boot.
MakeCode (TypeScript)
// Requires extension: TCS34725 (search "TCS34725" in MakeCode)
tcs34725.start()
basic.forever(function () {
let r = tcs34725.getRed()
let g = tcs34725.getGreen()
let b = tcs34725.getBlue()
serial.writeLine("RGB:" + r + "," + g + "," + b)
// Show the dominant channel as an icon
if (r > g && r > b) basic.showString("R")
else if (g > r && g > b) basic.showString("G")
else basic.showString("B")
basic.pause(400)
})
Test it · Status
Press Esc to clear the active status panel.
All four mods are stub — commands log only
until the firmware support lands.