This extension enables the use of the Backyard Brains Spiker:Bit with the Microsoft MakeCode editor. The Spiker:Bit records electrical activity from the brain (EEG), muscles (EMG), and heart (ECG), making neuroscience and physiology experiments accessible in educational settings. Use this extension to create interactive projects and explore real-time bio-signals in your classroom or lab For more details about the Spiker:Bit please check our product page https://backyardbrains.com/products/
This repository can be added as an extension in MakeCode.
- open https://makecode.microbit.org/
- click on New Project
- click on Extensions under the gearwheel menu
- search for https://github.com/BackyardBrains/pxt-spikerbit and import
To edit this repository in MakeCode.
- open https://makecode.microbit.org/
- click on Import then click on Import URL
- paste https://github.com/BackyardBrains/pxt-spikerbit and click import
Here is the API description and examples formatted for a GitHub README file:
Starts recording muscle (EMG) signals.
spikerbit.startMuscleRecording();
Returns the last envelope value of the EMG signal.
let power = spikerbit.musclePowerSignal();
Returns the raw EMG signal.
let rawSignal = spikerbit.muscleRawsignal();
Starts recording heart (ECG) signals.
spikerbit.startHeartRecording();
Returns the last measured ECG signal.
let signal = spikerbit.heartSignal();
Returns the calculated heart rate based on the last two heart beats.
let rate = spikerbit.heartRate();
Starts recording brain (EEG) signals.
spikerbit.startBrainRecording();
Returns the last measured EEG signal.
let signal = spikerbit.brainSignal();
Returns the alpha wave power of the EEG signal.
let alphaPower = spikerbit.brainAlphaPower();
Prints the signal value to the serial output.
spikerbit.print(spikerbit.heartRate());
Returns the recorded signal block for the last 3 seconds. If you pass durationMs parameter it will return just last durationMs of data.
let signalBlock = spikerbit.signalBlock();
let shortSignalBlock = spikerbit.signalBlock(500);
Returns max value of signal for the specified duration in milliseconds. For EMG it returns max of power (envelope) of the signal. For EEG and ECG it returns max of raw signal. Uses an internal buffer sampled at 250 Hz.
let maxDuringLastSecond = maxSignalInLast(1000);
Returns the number of peaks in the signal for the specified duration in milliseconds.
let numPeaks = numPeaksInLast(1000);
- for PXT/microbit