Subject:
|
Optical card reader for the RCX
|
Newsgroups:
|
lugnet.robotics
|
Date:
|
Thu, 28 Sep 2000 20:27:32 GMT
|
Original-From:
|
Giacomo <CAMP0S@LIBERO.ITavoidspam>
|
Viewed:
|
763 times
|
| |
| |
Hello ! ,
I'm trying to do a optical card reader using the light sensor of the RCX.
I put on a 8x6 board different 2x1 smooth piecies of varios colors ,then i
slice them near to the light sensor and i got different value depending of
which color the sensor is seeing.
I found that:
black ones gives 31 to 34
yellow and whithe ones gives 46-49
blu ones 37-39
and when there is nothing the value drops to 28-29.
Now, i'm a bit in difficult way, because i could'nt find a way to correctly
read the "card" : I'm using two main value, if the sensor reads more than
47, then it's a 1, if the value is under 47, it's a 0.
Here is how it should work (but it did'nt):
:loop
if light>30 (if>30 there is a black piece before all the others ,it's a
start bit)
THEN
wait 80 (100 = 1 second)
read light--->V1 ( V1,V2,V3 are the variables in which I store data)
wait 80
read light--->V2
wait 08
read light--->V3
end loop
Then it checks and replace the value in the 3 variables,
if V1>46 then put 1, else a 0
if V2>46 then put 10, else a 0
if V3>46 then put 100, else a 0
After it adds the tree variables in TOTAL:
TOTAL=V1+V2+V3 and i get somethings like that: 000, 001, 101,..... .
Then it checks for the value in TOTAL and then do the respective command.
I put the Wait 80 to have enought time to move the card in front of the
sensor (by hand).
Schematics of the card: ( "==" is a 1x2 smooth piecie)
OOOOOOOO
OOOOOOOO
OOOOOOOO
OOOOOOOO
OOOOOOOO
========
1° is Black _| | | |_ 4° is the 3 color
2° is the 1 color _| |
|_ 3° is the 2 color
I think it's a sincronization problem, on not ?
(i'm using the Gordon Brick Programmer 1.4.6)
(thanks for reading until there,and i'm sorry for my (non good) English).
---
"Mine! Mine! It's all mine!"
-- Daffy Duck
---
|
|
Message has 2 Replies: | | Re: Optical card reader for the RCX
|
| (...) I think you would be better off looking for changes in brightness rather than absolute values. That way, you could figure out what's going on without having to worry about the speed at which the 'card' is moving past the detector. With your (...) (24 years ago, 28-Sep-00, to lugnet.robotics)
| | | Re: Optical card reader for the RCX
|
| "Giacomo" <lego-robotics@crynwr.com> wrote in message news:NDBBIEKBGLHLJPC...bero.it... (...) correctly (...) I read Steve sugestions and they are great. So here comes another option: You can avoid the sync problem by avoiding the timing technique (...) (24 years ago, 1-Oct-00, to lugnet.robotics)
|
3 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|