Sven Haiges
Published © CC BY

Calliope Messenger

This post describes how two calliope minis can be used to create a wireless messenger using the built-in radio.

IntermediateFull instructions provided1 hour1,529
Calliope Messenger

Things used in this project

Hardware components

Calliope mini
Calliope mini
×1
Seeed Grove Rotary Angle Sensor / Potentiometer
×1

Software apps and online services

Calliope mini Calliope PXT Editor

Story

Read more

Schematics

Calliope Receiver Complete

Mini screenshot (38) wjvddedjtd

Calliope Sender Complete

Mini screenshot (37) zgmtosn2q7

Code

Potimessenger Sender

JavaScript
The part that sends the message to the receiver, Calliope Mini 1
let lastposition = 0
let buchstabe = ""
let position = 0
let text = ""
let poti = 0
basic.forever(() => {
    poti = pins.analogReadPin(AnalogPin.C16)
    position = pins.map(
        poti,
        0,
        1020,
        0,
        25
    )
    buchstabe = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(position)
    if (lastposition != position) {
        music.playTone(262, music.beat(BeatFraction.Sixteenth))
    }
    lastposition = position
    basic.showString(buchstabe)
})
input.onButtonPressed(Button.B, () => {
    radio.sendString(text)
    basic.showString(text)
})
input.onButtonPressed(Button.A, () => {
    text += buchstabe
})
input.onGesture(Gesture.Shake, () => {
    text = ""
    basic.showLeds(`
        . . . . .
        . . . . .
        . # # # .
        . . . . .
        . . . . .
        `)
    music.playTone(330, music.beat(BeatFraction.Quarter))
    music.playTone(262, music.beat(BeatFraction.Whole))
    basic.pause(1000)
    basic.clearScreen()
})
radio.setGroup(0)
text = ""
lastposition = 0

Potimessenger Receiver

JavaScript
The receiving part, Calliope Mini 2
radio.onDataPacketReceived(({receivedString}) => {
    basic.showString(receivedString)
})
radio.setGroup(0)

Credits

Sven Haiges

Sven Haiges

3 projects • 6 followers

Comments