Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
justin1445
Published © GPL3+

Electromagnetic Field Detector - Arduino Uno

A simple Electromagnetic Field Detector.

BeginnerShowcase (no instructions)12 minutes50,784
Electromagnetic Field Detector - Arduino Uno

Things used in this project

Hardware components

Resistor 330 ohm
Resistor 330 ohm
×1
Resistor 100k ohm
Resistor 100k ohm
×1
LED (generic)
LED (generic)
×1
Arduino UNO
Arduino UNO
×1
USB-A to B Cable
USB-A to B Cable
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Fritszing Breadboard

Fritszing schematic

Code

Arduino Code

Arduino
int inPin = 3; 
int var = 0;
int pin11 = 5;

void setup() {
  Serial.begin(9600);
}
void loop() {
  var = analogRead(inPin);
  if(var >= 1){
    var = constrain(var, 1, 100;                        
    var = map(var, 1, 100, 1, 255);
    analogWrite(pin11, var);
   }else{
       analogWrite(pin11, 0);                     
  }
 Serial.println(var);
}

Credits

justin1445

justin1445

1 project • 6 followers
Former: ICT student "Davinci college" Former: Human Technology Student "Zadkine" Current: Anime & manga shop employee "Special Edition"

Comments