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:26] – phamquyenanh | lego_nxt_optical_sensor [2018/10/02 15:10] (current) – [Code] phamquyenanh | ||
---|---|---|---|
Line 56: | Line 56: | ||
</ | </ | ||
| | ||
- | ===== 3, Materials | + | ===== 3, Materials |
==== Materials and Sources ==== | ==== Materials and Sources ==== | ||
Line 70: | Line 70: | ||
| Lego NXT breadboard adapter | | Lego NXT breadboard adapter | ||
| LEGO Mindstorms NXT / EV3 Connector Cables | | LEGO Mindstorms NXT / EV3 Connector Cables | ||
- | ==== Software and Sources ==== | + | |
- | * Arduino ide | + | |
- | * ROBOTC for LEGO Mindstorms | + | |
===== 4, Interface A Sensor Mouse with Arduino | ===== 4, Interface A Sensor Mouse with Arduino | ||
==== Connection ==== | ==== Connection ==== | ||
Line 151: | 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 255: | Line 280: | ||
- https:// | - https:// | ||
- http:// | - http:// | ||
+ | - http:// | ||
If you have any questions please contact for me via email phamquyenanh.qb@gmail.com. | If you have any questions please contact for me via email phamquyenanh.qb@gmail.com. | ||
+ | ===== Download ===== | ||
+ | {{: | ||
lego_nxt_optical_sensor.1538515597.txt.gz · Last modified: 2018/10/02 14:26 by phamquyenanh