Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
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 hour5,062
Calliope Messenger

Things used in this project

Hardware components

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

Software apps and online services

Calliope mini Calliope PXT Editor

Story

Read more

Schematics

Calliope Receiver Complete

Calliope Sender Complete

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

4 projects • 17 followers

Comments