Things used in this project

Schematics

basic schematic
Ir bb vzjvobelke

Code

ATmega32u4_IRArduino
/*
*	Author		: Zavala Ortiz Vicente Arturo.
*	language	: .ino
*	Date		: September 12 2014 5:11:12 PM
*	Name		: ATmega32u4_IR.ino
*	Description : GP2Y0A02YK0F IR Distance Sensor (20-150 cm) test distance in Cm and In
*/


#include "TFT.h"
#include "GP2Y0A02YK0F.h"

GP2Y0A02YK0F irSensor;
int cm;

void setup() 
{
  Tft.init();
  irSensor.begin(A0);	//	Assign A0 as sensor pin
}

void loop()
{

  cm = irSensor.getDistanceCentimeter();
  
  Tft._puts("\nDistance : ");
  Tft._print_dec(cm);  
  Tft._puts(" CM");
  
  Tft._puts("\nDistance : ");
  Tft._printdec(cm / 2.54);
  Tft._puts(" IN");

  delay(500); 
  
  Tft.clrscr();
}

Credits

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

I Keep my Cucumber Growing Conditions Moist - Part 2
Easy
  • 196
  • 4

Full instructions

This is the next step with an Ultrasonic HC-SR04 Echo and LCD 1602.

Create a PCB from Scratch with Upverter
Easy
  • 155
  • 4

Full instructions

This tutorial is intended as an example to carry out the Hackster live Meetup of May 2017, that is the creation of a PCB with Upverter.

Laser Stuff
Easy
  • 526
  • 3

A laser module that makes light patterns.

LEDog Collar
Easy
  • 897
  • 10

Full instructions

The LEDog collar lights up when it gets dark, helping you locate your dog from far away.

Handheld Infinity Kaleidoscope Group Kit
Easy
  • 2,661
  • 30

Full instructions

Use the orientation sensor in your Arduino 101 to control a cool Petri dish infinity-mirror illusion. This project is great for groups.

Arduino 101 BLE RGB Lamp
Easy
  • 544
  • 7

Full instructions

Create your own RGB controlled lamp with Arduino 101 using BLE.

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login
Feedback