Alin D
Published © GPL3+

3-Wire Inductive Sensor and LeoStick

Use a 3-wire inductive metal sensor with a LeoStick.

BeginnerShowcase (no instructions)1 hour712
3-Wire Inductive Sensor and LeoStick

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
3 wire inductive sensor
×1
Power supply 10-30V
×1
LED (generic)
LED (generic)
×1
RobotGeek Voltage Divider
RobotGeek Voltage Divider
×1
Jumper wires (generic)
Jumper wires (generic)
×1
LeoStick
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

fkujyz0ikfrxisu_large_gUYWCZ1I0U.jpg

Code

Untitled file

Arduino
/* DigitalReadSerial Reads a digital input on pin 2, prints the result to the serial monitor/serial plotter

This example code is in the public domain.

*/

// digital pin 2 has a PNP sensor attached to it.

int metalSensor = 2;

// the setup routine runs once when you press reset:

void setup()

{

// initialize serial communication at 9600 bits per second:

Serial.begin(9600);

// make the sensor's pin an input:

pinMode(metalSensor, INPUT);

}

// the loop routine runs over and over again forever:

void loop()

{

// read the input pin:

int sensorState = digitalRead(metalSensor);

// print out the state of the sensor:

Serial.println(sensorState);

delay(1000);

// delay in between reads for stability

}

Credits

Alin D

Alin D

1 project • 0 followers

Comments