CMNB05- AI module for arduino

$29.99

Category:

Description

CMNB05 is an AI module designed for arduino.

feature:

  • small in size
  • simple Pin out
  • full AI functions
  • input voltage 3.7-5V
  • output active high(3.3V)

 

Application 1: motion detection

 

Whenever motion is detected, pin OUTPUT1 will pull high  for 100ms then pull low.

Below is the block diagram.

 

example code

// this constant won't change:
const int motionPin = 2; // the pin that the OUTPUT1 is attached to

// Variables will change:
int motionState = 0; // current state of the OUTPUT1
int lastMotionState = 0; // previous state of the OUTPUT1

void setup() {
// initialize  pin as a input:
pinMode(motionPin, INPUT);
// initialize serial communication:
Serial.begin(9600);
}

void loop() {
motionState = digitalRead(motionPin);
if (motionState != lastMotionState) {
if (motionState == HIGH) {
Serial.println("motion detected");
//next do whatever you want to do
}
// Delay a little bit to avoid bouncing
delay(50);
}
// save the current state as the last state, for next time through the loop
lastMotionState = motionState;
}