I was able to make the sensor work on the Arduino Leonardo but the Bitcraze Optical Flow Breakout pmw3901 board does not work on the Nicla Vision.
**Bitcraze Optical Flow Breakout pmw3901 board to Arduino connections:
**
3-5v to VIN
Cs to Cs
SCK to SLCK
MOSI to COPI
MISO to CIPO
Gnd to Gnd
The following code (The “flow” example from the Bitcraze PMW3901 Library) worked on the Arduino Leonardo but not the Nicla Vision:
#include "Bitcraze_PMW3901.h"
// Using digital pin 10 for chip select
Bitcraze_PMW3901 flow(10);
void setup() {
Serial.begin(9600);
if (!flow.begin()) {
Serial.println("Initialization of the flow sensor failed");
while(1) { }
}
}
int16_t deltaX,deltaY;
void loop() {
// Get motion count since last call
flow.readMotionCount(&deltaX, &deltaY);
Serial.print("X: ");
Serial.print(deltaX);
Serial.print(", Y: ");
Serial.print(deltaY);
Serial.print("n");
delay(100);
}
I am wondering what needs to be changed to work on the Nicla Vision.
I tried this but no output on the serial monitor:
#include "Bitcraze_PMW3901.h"
// Using digital pin 10 for chip select
Bitcraze_PMW3901 flow(PE_11);
void setup() {
Serial.begin(9600);
if (!flow.begin()) {
Serial.println("Initialization of the flow sensor failed");
while(1) { }
}
}
int16_t deltaX,deltaY;
void loop() {
// Get motion count since last call
flow.readMotionCount(&deltaX, &deltaY);
Serial.print("X: ");
Serial.print(deltaX);
Serial.print(", Y: ");
Serial.print(deltaY);
Serial.print("n");
delay(100);
}
Odydagreek is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.