 I have a conductive rubber cord that works great with using the FSR code that is meant for the Arduino Uno. I want to use it with the feather so that it can be wireless, and smaller. I am first trying to get it working through the USB cable, before trying to make it wireless. For some reason it only prints this…

Resistance: 0.00 ohms
Force: inf g

Here is the code:

``````/******************************************************************************
Force_Sensitive_Resistor_Example.ino
Example sketch for SparkFun's force sensitive resistors
(https://www.sparkfun.com/products/9375)
Jim Lindblom @ SparkFun Electronics
April 28, 2016

Create a voltage divider circuit combining an FSR with a 3.3k resistor.
- The resistor should connect from A0 to GND.
- The FSR should connect from A0 to 3.3V
As the resistance of the FSR decreases (meaning an increase in pressure), the
voltage at A0 should increase.

Development environment specifics:
Arduino 1.6.7

Tried to adapt this code for the Adafruit Feather HUZZAH ESP8266. It's not working...
******************************************************************************/
const int FSR_PIN = 14; // Pin connected to FSR/resistor divider

// Measure the voltage at 3.3V and resistance of your 10k resistor, and enter
// their value's below:
const float VCC = 3.28; // Measured voltage of Ardunio 3.3V line
const float R_DIV = 9788.0; // Measured resistance of 10k resistor

void setup()
{
Serial.begin(115200);
pinMode(FSR_PIN, INPUT);
}

void loop()
{
// If the FSR has no pressure, the resistance will be
// near infinite. So the voltage should be near 0.
{
float fsrV = fsrADC * VCC / 1023.0;
// Use voltage and static resistor value to
// calculate FSR resistance:
float fsrR = R_DIV * (VCC / fsrV - 1.0);
Serial.println("Resistance: " + String(fsrR) + " ohms");
// Guesstimate force based on slopes in figure 3 of
// FSR datasheet:
float force;
float fsrG = 1.0 / fsrR; // Calculate conductance
// Break parabolic curve down into two linear slopes:
if (fsrR <= 600)
force = (fsrG - 0.00075) / 0.00000032639;
else
force =  fsrG / 0.000000642857;
Serial.println("Force: " + String(force) + " g");
Serial.println();

delay(500);
}
else
{
// No pressure detected
}
}
``````

I also tried declaring the ADC pin because that’s analog, but the arduino code didn’t like it when it verified.

``````const int FSR_PIN = 14; // Pin connected to FSR/resistor divider
``````

oops.