Optical Finger Navigation (OFN) - Parallax OFN module 27903
.
Parallax Optical Finger Navigation Module 27903
Overview
Library and demo code for driving the Parallax OFN module 27903 via I2C. The datasheet for the module is available here.
Contributed by Guru Das Srinagesh and Neha Kadam.
Connections
Here is the wiring diagram for the demo code:
mbed | OFN |
---|---|
p9 | SDA |
p10 | CLK |
VU | Vdd |
GND | GND |
When connecting Vdd and GND, make sure to connect the outermost pins as shown below:
The default X and Y orientation with respect to the image above is as follows:
- Left is -ve X axis; Right is +ve X axis
- Top is +ve Y axis; Bottom is -ve Y axis
Here is the demo for the Hello_World program. It displays the X and Y displacement and Orientation of the module.
main.cpp
#include "ofn.h" OFN ofn(p9, p10); Serial pc(USBTX, USBRX); int x, y, orient; int main(){ while(true) { while(ofn.checkMotion()){ x = ofn.readX(); y = ofn.readY(); orient = ofn.readOrientation(); pc.printf("X, Y: (%d, %d) & Orientation = %d \n", x, y, orient); } } }
Import programOFN_Hello_World_Demo
Demo code for Parallax OFN module 27903
Import libraryOFN
Version 1.0 - Library for Parallax OFN module 27903
Please log in to post comments.