I am getting better at Codea by the year but I have a question because every time I make like a type in password you can just look at the code so I would like to make a scanner. This is how it would work on the back of my school ID I have a number I would like to use the camera and scan it for a password like thing.
@joaquin Here something I wrote back in 2014. Don’t know if this is what you’re after or if it still works. Here’s the link.
https://codea.io/talk/discussion/5153/upc-barcode-reader#latest
@dave1707 Thanks that was convenient anyway one thing I realized is that every question I had you answered except for my previous 1 but other that thanks
Another question how does it work
@joaquin The distance between the bars and the size of the bars is used to determine a value. That value is converted to a number. You can do a google search on barcodes that will give you a better description of how it works.
@joaquin I found this link that might explain things.
https://www.explainthatstuff.com/barcodescanners.html
@dave1707 I get that. What I mean is how did you make it change from green to red based from the camera ,when I was looking at the code I still couldn’t get it.
Quick follow up question is it possible to modify the code to get something else like scan a number
@joaquin I have to go somewhere right now so I can’t answer the green to red question until I can look over the code. As for scanning a number, no. This is just for barcodes. It might be possible to write code to read numbers.
@joaquin Here’s the code that changes what’s on the screen to red or green. I’m using the set command to change each pixel color.
for z=1,25 do
if t<GreenRed then
img:set(x,250+z,255,0,0) -- (255,0,0) is red
c=1
else
img:set(x,250+z,0,255,0) -- (0,255,0) is green
c=0
end
end