O'Reilly logo

Arduino: Building exciting LED based projects and espionage devices by Marco Schwartz, Utsav Shah, Samarth Shah, Adith Jagdish Boloor

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Building the EMF bug detector

We are now going to dive into the core of this project and configure the project so that it can detect EMF activity around the antenna.

The following is the complete code for this project:

// Required libraries #include <Wire.h> #include <LiquidCrystal_I2C.h> // Number of readings #define NUMREADINGS 15 // Parameters for the EMF detector int senseLimit = 15; int probePin = 0; int ledPin = 7; int val = 0; int threshold = 200; // Averaging the measurements int readings[NUMREADINGS]; int index = 0; int total = 0 int average = 0; // Time between readings int updateTime = 40; // Create LCD instance LiquidCrystal_I2C lcd(0x27,20,4); void setup() { // Initialise LCD lcd.init(); // Set LED as output pinMode(ledPin, OUTPUT); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required