lego_nxt_optical_sensor
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
lego_nxt_optical_sensor [2018/10/02 14:44] – [Reference] phamquyenanh | lego_nxt_optical_sensor [2018/10/02 15:10] (current) – [Code] phamquyenanh | ||
---|---|---|---|
Line 149: | Line 149: | ||
// put a hold on the incoming data | // put a hold on the incoming data | ||
low(_clockPin); | low(_clockPin); | ||
+ | } | ||
+ | </ | ||
+ | Reading data from optical mouse sensor | ||
+ | <code c Read> | ||
+ | void readdd() | ||
+ | { | ||
+ | requestData(); | ||
+ | Dstatu = readByte(); // this byte for buttons | ||
+ | Dx = readByte(); | ||
+ | Dy = readByte(); | ||
+ | if (_supportsIntelliMouseExtensions) { | ||
+ | DataWheel[count] = readByte(); | ||
+ | count++; | ||
+ | | ||
+ | } | ||
+ | X += (int)Dx; | ||
+ | Y += (int)Dy; | ||
+ | if(count==3) | ||
+ | { | ||
+ | for(count; | ||
+ | { | ||
+ | Sum+=(int)DataWheel[count]; | ||
+ | } | ||
+ | if(Sum> | ||
+ | else if(Sum< | ||
+ | Sum=0; | ||
+ | } | ||
} | } | ||
</ | </ | ||
Line 256: | Line 283: | ||
If you have any questions please contact for me via email [email protected]. | If you have any questions please contact for me via email [email protected]. | ||
===== Download ===== | ===== Download ===== | ||
- | {{:wiki:dynamixelcode12.rar|}} | + | {{:wiki:i2cnxtandarduino.rar|}} |
lego_nxt_optical_sensor.1538516642.txt.gz · Last modified: 2018/10/02 14:44 by phamquyenanh