Let's Make Robots!


Ok so for one i moved it to a blog and two it now has some different functions.

The first thing i added was a password. In-order to get to the main menu, you have to type in a sequence using the input buttons.

The second new thing is the distance feature. I sat down and changed the sharp's numbers to inches and figured out to what extent to change the distance to the next one. It is pretty accurate but only goes up to 12in and down to 4in.

The third new feature, and my favorite, is the calculator function. It is what it sounds like, its a 4 function calculator. The down side is no decimals. This little code i wrote up real quick and it seems to work well. What i really wanted to do was be able to change the ten's place and one's place separately. Im glad i did this, learned a lot more about arduino. Did i mention it uses a arduino mini pro 328? well it does. 




OSP.pde12.21 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Wow! I like it very much!

It looks like the laser meter that are now in commerce, but you added the calculator function!

I'm not pratic with the sharp sensor, and i have a stupid question. Do you know  if it is possible to releave the distance also in meters, (or centimeters)?

Keep going on with the good job!


well it gives you the read outs in weird numbers like 200. those numbers have to be changed by you so you could maybe do centimeters i choose inches because im a weird american. meters may be too big in distance to measure.


ah, ok, I think I've understood. So to translate the weird numbers that the sensor split out to a "human" distance it necessary a sort of calibration. For example "45" correspond to "8" inches (or whatever), "76" correspond to "9" inches and so on...Is it right?

But i wonder if it is really linear

that is right. No its not perfectly linear. I had to just use debug to see the values next to a ruler.

There are calculations to translate the raw value spat out by a sharp IR into centimetres or inches. Acroname have some good information on trying to make the numbers more readable.

Specifically for the Arduino I use the formula distance = (6787 / (val - 3)) - 4;  where val is the number from the sharp and distance is the resulting cms. To change that to inch you would just divide by 2.54.

It has a timer now. 

i was so impressed with this...i just ordered my first arduino and after i learn a little bit of code, i want to something similar to this with the SFE joystick shield and i always wanted to add one more feature...xbee wireless control....imagine having this cool gadget in ur pocket which can tell u the distance, act as a calculator and CONTROL ur robot

Thanks, this was my first arduino project, cool to see it will be yours too.