Thomas
Published © CC BY-NC-SA

Ferngesteuertes Auto

Mit zwei Calliope wird ein ferngesteuertes Auto erstellt.

BeginnerWork in progress1 hour609
Ferngesteuertes Auto

Things used in this project

Hardware components

Calliope mini v0.3 (pre-production)
Calliope mini v0.3 (pre-production)
×1
Roboter Fahrgestell
×1
Platinensteckverbinder
×1
Batterieclip
×1

Software apps and online services

PXT-Editor für Calliope rev 3

Story

Read more

Schematics

PXT-Schema

Code

Java

JavaScript
input.onPinPressed(TouchPin.P0, () => {
    radio.sendNumber(2)
    basic.showLeds(`
        . . # . .
        . # . . .
        # # # # #
        . # . . .
        . . # . .
        `)
})
radio.onDataPacketReceived(({receivedNumber}) => {
    if (receivedNumber == 1) {
        motors.dualMotorPower(Motor.A, 0)
        basic.setLedColor(Colors.Green)
        motors.dualMotorPower(Motor.AB, 50)
    } else if (receivedNumber == 0) {
        motors.dualMotorPower(Motor.A, 0)
        basic.setLedColor(Colors.Red)
        motors.dualMotorPower(Motor.AB, 0)
    } else if (receivedNumber == 2) {
        motors.dualMotorPower(Motor.A, 0)
        basic.setLedColor(Colors.Orange)
        motors.dualMotorPower(Motor.A, 50)
        motors.dualMotorPower(Motor.B, 0)
    } else if (receivedNumber == 3) {
        basic.setLedColor(Colors.Orange)
        motors.dualMotorPower(Motor.A, 0)
        motors.dualMotorPower(Motor.B, 50)
    }
})
input.onPinPressed(TouchPin.P1, () => {
    basic.showLeds(`
        . . # . .
        . # # # .
        # . # . #
        . . # . .
        . . # . .
        `)
    radio.sendNumber(1)
})
input.onPinPressed(TouchPin.P2, () => {
    radio.sendNumber(0)
    basic.showLeds(`
        . . . . .
        # # # # #
        # # # # #
        . . . . .
        . . . . .
        `)
})
input.onPinPressed(TouchPin.P3, () => {
    radio.sendNumber(3)
    basic.showLeds(`
        . . # . .
        . . . # .
        # # # # #
        . . . # .
        . . # . .
        `)
})
radio.setGroup(1)
basic.setLedColor(Colors.Red)

Credits

Thomas

Thomas

1 project • 0 followers

Comments