Ingo Lohs
Published © GPL3+

Flexible Touch Sensor FSR 402 from IEFSR.com

The FSR 402 model is a single-zone Force Sensing Resistor® optimized for use in human touch control of electronic devices.

EasyProtip24 minutes291

Things used in this project

Hardware components

Force Sensing Resistor FSR 402
×1
Photon
Particle Photon
×1
Jumper wires (generic)
Jumper wires (generic)
2 pieces
×1
Breadboard (generic)
Breadboard (generic)
optional
×1

Story

Read more

Code

FSR 402 - put the LED on/off

C/C++
// Touch-Sensor Particle Photon - works with v0.7.0 without Libaries
// Ingo Lohs, v1.0 v. 08.04.2018
// after the touch of the sensor, the Photon LED is on

// Definitions
const int TOUCH_PIN_IN = D4;   // Pin connected to SIG at Touch-Sensor
const int LED_PIN = D7;        // LED pin

unsigned long lastmillis = 0;  // time for interation the loop


void setup() 
{
  pinMode(TOUCH_PIN_IN, INPUT);
  pinMode(LED_PIN, OUTPUT);
}


void loop() 
{
    if ((millis() - lastmillis) > 10) { // play with the millis
        lastmillis = millis();
        readData();
    }
}


void readData() {

    int proximity = digitalRead(TOUCH_PIN_IN); // Read the state of the sensor
    
        if (proximity == HIGH) 
        {
        digitalWrite(LED_PIN, LOW); // Turn the LED off
        }
        else
        {
        digitalWrite(LED_PIN, HIGH); // Turn the LED on
        }    
}

Credits

Ingo Lohs

Ingo Lohs

32 projects • 49 followers
I am well over 40 years and come from the middle of Germany. You can contact me also in German. Donation for projects: paypal.me/ingolohs
Contact

Comments

Add projectSign up / Login