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

Using CA and CC RGB LED by Current Sourcing and Sinking!
Easy
  • 352
  • 23

Protip

RGB LEDs are of two types, common cathode and common anode which behave differently with same Arduino code; how to resolve this.

Arduino Amiga Floppy Disk Reader
Easy
  • 2,242
  • 5

Work in progress

An Arduino powered floppy disk controller and reader for making disk images from old AmigaDOS floppy disks.

Quadrature Encoder Demo
Easy
  • 15
  • 1

Full instructions

Use a 3D printed encoder wheel, LED, and 2 photocells to demonstrate how a quadrature encoder works.

Micro:bit Moisture sensor
Easy
  • 158
  • 4

Protip

In this quick and easy project, you build a micro:bit moisture sensor

3D-Printed, Internet-Controlled, Self-Balancing FPV Robot
Easy
  • 1,612
  • 22

Full instructions

Open source telepresence robot that keeps its balance on two wheels. Controlled from UI in the web browser.

Arduino Controlled USB Trackpad
Easy
  • 2,598
  • 4

Full instructions

I really want to make a Raspberry Pi laptop but just can't find the right size trackpad so in this project we will be salvaging an old one.

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login