
CodeCell includes a built-in BNO085 motion sensor capable of detecting tap gestures through its onboard accelerometer and sensor fusion algorithms.
The BNO085 continuously monitors acceleration patterns and detects sudden short impulses that match a “tap” motion. Tap detection is handled entirely by the sensor and read through the CodeCell Library, which makes it easy to use with just two lines of code:
myCodeCell.Init(MOTION_TAP_DETECTOR);   // Enable tap detection mode
if (myCodeCell.Motion_TapRead()) {
  // Executes when a tap is detected
}
Each tap triggers a digital flag that can be used to control LEDs, motors, or other actions -all without writing any complex filtering logic.
This example lights up CodeCell’s onboard LED in yellow for one second whenever a tap is detected.
#include <CodeCell.h>
CodeCell myCodeCell;
void setup() {
  Serial.begin(115200);
  myCodeCell.Init(MOTION_TAP_DETECTOR);  // Enable tap detection
}
void loop() {
  if (myCodeCell.Run(10)) {              // Run at 10 Hz
    if (myCodeCell.Motion_TapRead()) {   // Detect tap
      myCodeCell.LED(0xA0, 0x60, 0x00);  // Yellow LED feedback
      delay(1000);                       // Hold LED for 1 second
    }
  }
}
Join our Community ~ Be the first to know about new products and get exciting deals!
            © 2025 Microbots.