Coder Social home page Coder Social logo

responsiveanalogread's People

Contributors

dxinteractive avatar kschaffer avatar mjs513 avatar per1234 avatar shahul3d avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

responsiveanalogread's Issues

12bit input

Hello,

I've tried the library on a Teensy 3.1. It works well.

Would you consider making it compatible with a 12-bit analog resolution? Currently it seems to be limited to a 10-bit resolution.

Smoothing variable

Great Library! Thank you for the time you spent on programming it.

I have one question. I do not want to smooth a value from analog input, but a variable from a light sensor that is connected via I2C. Is this possible with your library?

Best

Peter

smoothValue not initialized

smoothValue is not inizialized. hasChanged() can return always false depending on its (undefined) initial value.

I suggest somenthing like that:

float smoothValue = 0.0;

Regards
alf45tar

Untie the responsive part from the reading part

Hi,

I am already using your library for a power meter which works great.

This time I am receiving data from an external ADC (i2c) and not readings from a pin. I still want to use your library for the smoothing part.

I am aware I can update(val) without reading the pin, but the constructor ResponsiveAnalogRead(int pin, bool sleepEnable, float snapMultiplier) still needs a pin, and messes with the pin mode.

I guess it is just a matter of overloading the constructor and provide a default, empty one?

If it is just it I can provide a PR.

Thanks for you blog post, the javascript examples are pretty nice.

Mike

smooting any integer/float

Hi,
thank you for great piece of code!
i'm trying to flow meter based on popular hall effect flow sensors. The problem is for small flow rates the pulse frequency is pretty slow and thus noisy. Is your library able to handle variables instead of direct analog pin reading?
For example to make an object like that:
ResponsiveAnalogRead analog(measured_value, true);
where: measured_value can be any float or integer

What you think about it?
Rgds,
Bogi

Cant convert .getValue to int

i am using this to reduce noise on my hall effect gimbal and when i try to convert .getValue to my integer it just doesent work

newThreshold - Does it work?

I have this in setup()

void enableEdgeSnap();
float newThreshold = 10.0;
void setActivityThreshold(float newThreshold);

I see to change in the sensitivity of the threshold. I can set it to 500.0 and I still no change in sensitivity.
Am I doing it wrong?

keeping it from updating all the time.

when i am useing the libary it outputs data all the time, but i only want it to output when i have changed the value of the potentiometer

if it is even possible, how would this be done?

How to use certain functions?

Im having trouble understanding how to use the setAnalogResolution and setSnapMultiplier functions can someone clue me in on how to format them?

suggested update: provide a default constructor

Hello!

I have been working on using your lovely smoothing algorithm as part of a larger Teensy-based project that has its own little library. As such, I need the ability to use responsiveAnalogRead objects as member variables of a class, which means I need a default constructor that doesn't do anything. I have a version of your code where I just add in a responsiveAnalogRead() constructor that does nothing, and add in a setup(int pin, bool sleepEnable, float snapMultiplier) function to replace what the constructor was previously doing. This seems to work just fine.

Right now I have both constructor options, but I suppose a different approach (like how bounce2 is different from bounce) would be to have a second version of the library with a different expected initialization process. Anyway, we have our own copy of your code with my modifications working fine for our project, but I thought you might want to consider a change along these lines for the 'official' version too. It makes your library usable in an expanded range of contexts.

Snap with sleep enabled

In getResponsiveValue:

` // when sleep is enabled, the emphasis is stopping on a responsiveValue quickly, and it's less about easing into position.

// If sleep is enabled, add a small amount to snap so it'll tend to snap into a more accurate position before sleeping starts.

if(sleepEnable) {
snap *= 0.5 + 0.5;
}
`
I don't think it means what you think it means.

"+" has higher precedence than "*=". Furthermore "*=" is right associative. Isn't

snap *= 0.5 + 0.5;

equivalent to :

snap *= 1.0;

Did you perhaps mean:

snap = 0.5*snap + 0.5;

reading on every update()?

I think, looking at the source for your library, that you are reading the analog input on every iteration through the main Arduino loop(), yes?

Is that necessary? Wouldn't it be hard on a battery powered application?

getRawValue() always return 0

getRawValue() returns a rawValue that is never updated.

Suggested fix (not tested):

void ResponsiveAnalogRead::update(int rawValue)
{
  this->rawValue = rawValue; // Save rawValue for getRawValue()

  prevResponsiveValue = responsiveValue;
  responsiveValue = getResponsiveValue(rawValue);
  responsiveValueHasChanged = responsiveValue != prevResponsiveValue;
}

Out of bounds value

Hi.
I'm currently using ResponsiveAnalogRead for a joystick projet. The joystick I use has two pots, X and Y. Very classic setup.

I use calibration phase, during which I push the joystick far in each direction. So far, it works fine. Once the calibration is done, I run a loop into which I read the values, and sends them through USB.

The problem happens right after the calibration.

Here's the code I use:
sketch.txt

And its output:

Calibration ended:
xMin = 198
xMax = 224
yMin = 216
yMax = 244
All is ok, acting like a real stick now!!
Y changed: 286->2560
Y changed: 289->2669
Y changed: 291->2742
Y changed: 292->2779
Y changed: 293->2816
Y changed: 294->2852
Y changed: 295->2889
Y changed: 296->2925
Y changed: 297->2962
Y changed: 298->2998
X changed: 210->472

As you see, calibration works fine. But right after it, Y axis goes nuts and gives me out of bounds values. This is very strange, as I use the very same treatment for X, and X works perfectly.

Compilation Error in Arduino 1.0.6 with ATmega8 microcontroller

Hello!
I tried to compile code with arduino 1.0.6 with Atmega8 microcontroller and got following error during compilation.

In file included from pulseWidthCalculator_V01.ino:3:
C:\Users\Strange Lab\Documents\Arduino\libraries\ResponsiveAnalogRead\src/ResponsiveAnalogRead.h:64: error: ISO C++ forbids initialization of member 'analogResolution'
C:\Users\Strange Lab\Documents\Arduino\libraries\ResponsiveAnalogRead\src/ResponsiveAnalogRead.h:64: error: making 'analogResolution' static
C:\Users\Strange Lab\Documents\Arduino\libraries\ResponsiveAnalogRead\src/ResponsiveAnalogRead.h:64: error: ISO C++ forbids in-class initialization of non-const static member 'analogResolution'
C:\Users\Strange Lab\Documents\Arduino\libraries\ResponsiveAnalogRead\src/ResponsiveAnalogRead.h:67: error: ISO C++ forbids initialization of member 'activityThreshold'
C:\Users\Strange Lab\Documents\Arduino\libraries\ResponsiveAnalogRead\src/ResponsiveAnalogRead.h:67: error: making 'activityThreshold' static
C:\Users\Strange Lab\Documents\Arduino\libraries\ResponsiveAnalogRead\src/ResponsiveAnalogRead.h:67: error: ISO C++ forbids in-class initialization of non-const static member 'activityThreshold'
C:\Users\Strange Lab\Documents\Arduino\libraries\ResponsiveAnalogRead\src/ResponsiveAnalogRead.h:68: error: ISO C++ forbids initialization of member 'edgeSnapEnable'
C:\Users\Strange Lab\Documents\Arduino\libraries\ResponsiveAnalogRead\src/ResponsiveAnalogRead.h:68: error: making 'edgeSnapEnable' static
C:\Users\Strange Lab\Documents\Arduino\libraries\ResponsiveAnalogRead\src/ResponsiveAnalogRead.h:68: error: ISO C++ forbids in-class initialization of non-const static member 'edgeSnapEnable'
C:\Users\Strange Lab\Documents\Arduino\libraries\ResponsiveAnalogRead\src/ResponsiveAnalogRead.h:72: error: ISO C++ forbids initialization of member 'errorEMA'
C:\Users\Strange Lab\Documents\Arduino\libraries\ResponsiveAnalogRead\src/ResponsiveAnalogRead.h:72: error: making 'errorEMA' static
C:\Users\Strange Lab\Documents\Arduino\libraries\ResponsiveAnalogRead\src/ResponsiveAnalogRead.h:72: error: ISO C++ forbids in-class initialization of non-const static member 'errorEMA'
C:\Users\Strange Lab\Documents\Arduino\libraries\ResponsiveAnalogRead\src/ResponsiveAnalogRead.h:73: error: ISO C++ forbids initialization of member 'sleeping'
C:\Users\Strange Lab\Documents\Arduino\libraries\ResponsiveAnalogRead\src/ResponsiveAnalogRead.h:73: error: making 'sleeping' static
C:\Users\Strange Lab\Documents\Arduino\libraries\ResponsiveAnalogRead\src/ResponsiveAnalogRead.h:73: error: ISO C++ forbids in-class initialization of non-const static member 'sleeping'

smoothValue left uninitialized

in ResponsiveAnalogRead.h, float smoothValue; may cause problems (I had a problem in one of my projects where different hardware initialised with different values). Should possibly be
float smoothValue = 0.0;

Suspicious line

Hi, this line

snap *= 0.5 + 0.5;

is a NOP, if I'm not mistaken: it multiplies snap by 1.0.

Need a little help :(

Hello,
i am using 3 times a 16 Multiplexer to get 48 Analog inputs to send by using slider a midi signal out of an Arduino MEGA.

With your Example i have very good results already. But for shame i am not a pro scripter and i would love to ask for help in my case.......i have a little budget which i could spend for a resolution to my "jitter" slider.

If you would help me, could i send you an email with my little piece of code and you could show me how to use your libraby function of analog read ?

My only problem is the jitter of my sliders....all other stuff i got to work already.......so i am not asking for totally script all my code.....

Thank you so much already
Sascha
(germany)

Teensy 3.2 issue

Hi,
Just trying a very simple program to test the library on a teensy 3.2. It runs totally fine - apart from when in the range of around 480-560. The closer to the mid point I get, the more crazy it gets - continuous jitter up to 20 difference in value. I have tried it with two different pots (different makes), and I have also tested a simple analogue read program using exactly the setup, which it outputs normally (didnt have the filter lib included). I can run your filter library fine on an arduino nano though - no problems at all.
Very odd.
Not a big deal for me, as I've just made my own simple filter which is working fine, but flagging it up in case you feel like looking into it.

getRawValue retuns 0, not raw analogread value

In testing I noticed the issue. the problem is you declared a local variable int rawValue in function ResponsiveAnalogRead::update. I made a simple change to make update:

void ResponsiveAnalogRead::update(int rawValueRead)
{
  rawValue = rawValueRead;
  prevResponsiveValue = responsiveValue;
  responsiveValue = getResponsiveValue(rawValue);
  responsiveValueHasChanged = responsiveValue != prevResponsiveValue;
}

Did it this way to avoid issues with global variable and local variable with same name.

Not reading more then two analog pins

First of all great lib, but i have a problem reading more then two pins at the same time.
Is there something else to add to the code? here is my code right now only 3 pins are read
<
#include <SPI.h>
#include <Ethernet.h>
#include <PubSubClient.h>
#include <ResponsiveAnalogRead.h>

//const int pin0 = A0;
const int pin1 = A1;
const int pin2 = A2;
const int pin3 = A3;
const int pin4 = A4;
const int pin5 = A5;
const int pin6 = A6;
const int pin7 = A7;
const int pin8 = A8;
const int pin9 = A9;
const int pin10 = A10;
const int pin11 = A11;
const int pin12 = A12;
const int pin13 = A13;
const int pin14 = A14;
const int pin15 = A15;

ResponsiveAnalogRead analogZero(A0, true);
ResponsiveAnalogRead analog1(pin1, true);
ResponsiveAnalogRead analog2(pin2, true);
ResponsiveAnalogRead analog3(pin3, true);
ResponsiveAnalogRead analog4(pin4, true);
ResponsiveAnalogRead analog5(pin5, true);
ResponsiveAnalogRead analog6(pin6, true);
ResponsiveAnalogRead analog7(pin7, true);
ResponsiveAnalogRead analog8(pin8, true);
ResponsiveAnalogRead analog9(pin9, true);
ResponsiveAnalogRead analog10(pin10, true);
ResponsiveAnalogRead analog11(pin11, true);
ResponsiveAnalogRead analog12(pin12, true);
ResponsiveAnalogRead analog13(pin13, true);
ResponsiveAnalogRead analog14(pin14, true);
ResponsiveAnalogRead analog15(pin15, true);

#define PIN_SWITCH_1 22
#define PIN_SWITCH_2 23
#define PIN_SWITCH_3 24
#define PIN_SWITCH_4 25
#define PIN_SWITCH_5 26
#define PIN_SWITCH_6 27
#define PIN_SWITCH_7 28
#define PIN_SWITCH_8 29
#define PIN_SWITCH_9 30
#define PIN_SWITCH_10 31
#define PIN_SWITCH_11 32
#define PIN_SWITCH_12 33
#define PIN_SWITCH_13 34
#define PIN_SWITCH_14 35
#define PIN_SWITCH_15 36
#define PIN_SWITCH_16 37

/* the first measured value of the first point /
#define SENS_1_VAL 543.85
#define SENS_1_TMP 27.87
/
the second measured value of the second point */
#define SENS_2_VAL 544.25
#define SENS_2_TMP 27.91

// Update these with values suitable for your network.
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xEF, 0xED };
IPAddress ip(192, 168, 1, 74);
IPAddress server(192, 168, 1, 37);

void callback(char* topic, byte* payload, unsigned int length)
{

for (int i = 0; i < length; i++) {
char receivedChar = (char)payload[i];

if (strcmp(topic, "arduino01/pin22") == 0)
  if (receivedChar == '0')
    digitalWrite(22, HIGH);
if (strcmp(topic, "arduino01/pin22") == 0)
  if (receivedChar == '1')
    digitalWrite(22, LOW);

if (strcmp(topic, "arduino01/pin23") == 0)
  if (receivedChar == '0')
    digitalWrite(23, HIGH);
if (strcmp(topic, "arduino01/pin23") == 0)
  if (receivedChar == '1')
    digitalWrite(23, LOW);

if (strcmp(topic, "arduino01/pin24") == 0)
  if (receivedChar == '0')
    digitalWrite(24, HIGH);
if (strcmp(topic, "arduino01/pin24") == 0)
  if (receivedChar == '1')
    digitalWrite(24, LOW);

if (strcmp(topic, "arduino01/pin25") == 0)
  if (receivedChar == '0')
    digitalWrite(25, HIGH);
if (strcmp(topic, "arduino01/pin25") == 0)
  if (receivedChar == '1')
    digitalWrite(25, LOW);

if (strcmp(topic, "arduino01/pin26") == 0)
  if (receivedChar == '0')
    digitalWrite(26, HIGH);
if (strcmp(topic, "arduino01/pin26") == 0)
  if (receivedChar == '1')
    digitalWrite(26, LOW);

if (strcmp(topic, "arduino01/pin27") == 0)
  if (receivedChar == '0')
    digitalWrite(27, HIGH);
if (strcmp(topic, "arduino01/pin27") == 0)
  if (receivedChar == '1')
    digitalWrite(27, LOW);

if (strcmp(topic, "arduino01/pin28") == 0)
  if (receivedChar == '0')
    digitalWrite(28, HIGH);
if (strcmp(topic, "arduino01/pin28") == 0)
  if (receivedChar == '1')
    digitalWrite(28, LOW);

if (strcmp(topic, "arduino01/pin29") == 0)
  if (receivedChar == '0')
    digitalWrite(29, HIGH);
if (strcmp(topic, "arduino01/pin29") == 0)
  if (receivedChar == '1')
    digitalWrite(29, LOW);

if (strcmp(topic, "arduino01/pin30") == 0)
  if (receivedChar == '0')
    digitalWrite(30, HIGH);
if (strcmp(topic, "arduino01/pin30") == 0)
  if (receivedChar == '1')
    digitalWrite(30, LOW);

if (strcmp(topic, "arduino01/pin31") == 0)
  if (receivedChar == '0')
    digitalWrite(31, HIGH);
if (strcmp(topic, "arduino01/pin31") == 0)
  if (receivedChar == '1')
    digitalWrite(31, LOW);

if (strcmp(topic, "arduino01/pin32") == 0)
  if (receivedChar == '0')
    digitalWrite(32, HIGH);
if (strcmp(topic, "arduino01/pin32") == 0)
  if (receivedChar == '1')
    digitalWrite(32, LOW);

if (strcmp(topic, "arduino01/pin33") == 0)
  if (receivedChar == '0')
    digitalWrite(33, HIGH);
if (strcmp(topic, "arduino01/pin33") == 0)
  if (receivedChar == '1')
    digitalWrite(33, LOW);

if (strcmp(topic, "arduino01/pin34") == 0)
  if (receivedChar == '0')
    digitalWrite(34, HIGH);
if (strcmp(topic, "arduino01/pin34") == 0)
  if (receivedChar == '1')
    digitalWrite(34, LOW);

if (strcmp(topic, "arduino01/pin35") == 0)
  if (receivedChar == '0')
    digitalWrite(35, HIGH);
if (strcmp(topic, "arduino01/pin35") == 0)
  if (receivedChar == '1')
    digitalWrite(35, LOW);

if (strcmp(topic, "arduino01/pin36") == 0)
  if (receivedChar == '0')
    digitalWrite(36, HIGH);
if (strcmp(topic, "arduino01/pin36") == 0)
  if (receivedChar == '1')
    digitalWrite(36, LOW);
    
if (strcmp(topic, "arduino01/pin37") == 0)
  if (receivedChar == '0')
    digitalWrite(37, HIGH);
if (strcmp(topic, "arduino01/pin37") == 0)
  if (receivedChar == '1')
    digitalWrite(37, LOW);    

}
}

EthernetClient arduino01;
PubSubClient client(arduino01);

unsigned long lastMillis = 0;
long lastReconnectAttempt = 0;

boolean reconnect() {
if (client.connect("arduino01")) {
client.subscribe("arduino01/pin22");
client.subscribe("arduino01/pin23");
client.subscribe("arduino01/pin24");
client.subscribe("arduino01/pin25");
client.subscribe("arduino01/pin26");
client.subscribe("arduino01/pin27");
client.subscribe("arduino01/pin28");
client.subscribe("arduino01/pin29");
client.subscribe("arduino01/pin30");
client.subscribe("arduino01/pin31");
client.subscribe("arduino01/pin32");
client.subscribe("arduino01/pin33");
client.subscribe("arduino01/pin34");
client.subscribe("arduino01/pin35");
client.subscribe("arduino01/pin36");
client.subscribe("arduino01/pin37");
}

return client.connected();
}

void setup()
{
pinMode (PIN_SWITCH_1, OUTPUT);
pinMode (PIN_SWITCH_2, OUTPUT);
pinMode (PIN_SWITCH_3, OUTPUT);
pinMode (PIN_SWITCH_4, OUTPUT);
pinMode (PIN_SWITCH_5, OUTPUT);
pinMode (PIN_SWITCH_6, OUTPUT);
pinMode (PIN_SWITCH_7, OUTPUT);
pinMode (PIN_SWITCH_8, OUTPUT);
pinMode (PIN_SWITCH_9, OUTPUT);
pinMode (PIN_SWITCH_10, OUTPUT);
pinMode (PIN_SWITCH_11, OUTPUT);
pinMode (PIN_SWITCH_12, OUTPUT);
pinMode (PIN_SWITCH_13, OUTPUT);
pinMode (PIN_SWITCH_14, OUTPUT);
pinMode (PIN_SWITCH_15, OUTPUT);
pinMode (PIN_SWITCH_16, OUTPUT);
digitalWrite(22, HIGH);
digitalWrite(23, HIGH);
digitalWrite(24, HIGH);
digitalWrite(25, HIGH);
digitalWrite(26, HIGH);
digitalWrite(27, HIGH);
digitalWrite(28, HIGH);
digitalWrite(29, HIGH);
digitalWrite(30, HIGH);
digitalWrite(31, HIGH);
digitalWrite(32, HIGH);
digitalWrite(33, HIGH);
digitalWrite(34, HIGH);
digitalWrite(35, HIGH);
digitalWrite(36, HIGH);
digitalWrite(37, HIGH);
Serial.begin(9600);
client.setServer(server, 1883);
client.setCallback(callback);
Ethernet.begin(mac, ip);
delay(2000);
lastReconnectAttempt = 0;
}

void loop() {

if (!client.connected()) {reconnect();}

analogZero.update();
analog1.update();
analog2.update();
analog3.update();
analog4.update();
analog5.update();
analog6.update();
analog7.update();
analog8.update();
analog9.update();
analog10.update();
analog11.update();
analog12.update();
analog13.update();
analog14.update();
analog15.update();

int sensorValueZero = analogZero.getValue();
char temperatureZero[3];
float tempZero = (SENS_1_TMP + (SENS_2_TMP - SENS_1_TMP) / (SENS_2_VAL - SENS_1_VAL) * (sensorValueZero - SENS_1_VAL))-2;
dtostrf(tempZero, 0, 1, temperatureZero);

int sensorValue1 = analog1.getValue();
char temperature1[3];
float temp1 = (SENS_1_TMP + (SENS_2_TMP - SENS_1_TMP) / (SENS_2_VAL - SENS_1_VAL) * (sensorValue1 - SENS_1_VAL))-2;
dtostrf(temp1, 0, 1, temperature1);

int sensorValue2 = analog2.getValue();
char temperature2[3];
float temp2 = (SENS_1_TMP + (SENS_2_TMP - SENS_1_TMP) / (SENS_2_VAL - SENS_1_VAL) * (sensorValue2 - SENS_1_VAL))-2;
dtostrf(temp2, 0, 1, temperature2);

/*
int sensorValue3 = analog3.getValue();
char temperature3[3];
float temp3 = (SENS_1_TMP + (SENS_2_TMP - SENS_1_TMP) / (SENS_2_VAL - SENS_1_VAL) * (sensorValue3 - SENS_1_VAL))-2;
dtostrf(temp3, 0, 1, temperature3);

int sensorValue4 = analog4.getValue();
char temperature4[3];
float temp4 = (SENS_1_TMP + (SENS_2_TMP - SENS_1_TMP) / (SENS_2_VAL - SENS_1_VAL) * (sensorValue4 - SENS_1_VAL))-2;
dtostrf(temp4, 0, 1, temperature4);

int sensorValue5 = analog5.getValue();
char temperature5[3];
float temp5 = (SENS_1_TMP + (SENS_2_TMP - SENS_1_TMP) / (SENS_2_VAL - SENS_1_VAL) * (sensorValue5 - SENS_1_VAL))-2;
dtostrf(temp5, 0, 1, temperature5);

int sensorValue6 = analog6.getValue();
char temperature6[3];
float temp6 = (SENS_1_TMP + (SENS_2_TMP - SENS_1_TMP) / (SENS_2_VAL - SENS_1_VAL) * (sensorValue6 - SENS_1_VAL))-2;
dtostrf(temp6, 0, 1, temperature6);

int sensorValue7 = analog7.getValue();
char temperature7[3];
float temp7 = (SENS_1_TMP + (SENS_2_TMP - SENS_1_TMP) / (SENS_2_VAL - SENS_1_VAL) * (sensorValue7 - SENS_1_VAL))-2;
dtostrf(temp7, 0, 1, temperature7);

int sensorValue8 = analog8.getValue();
char temperature8[3];
float temp8 = (SENS_1_TMP + (SENS_2_TMP - SENS_1_TMP) / (SENS_2_VAL - SENS_1_VAL) * (sensorValue8 - SENS_1_VAL))-2;
dtostrf(temp8, 0, 1, temperature8);

int sensorValue9 = analog9.getValue();
char temperature9[3];
float temp9 = (SENS_1_TMP + (SENS_2_TMP - SENS_1_TMP) / (SENS_2_VAL - SENS_1_VAL) * (sensorValue9 - SENS_1_VAL))-2;
dtostrf(temp9, 0, 1, temperature9);

int sensorValue10 = analog10.getValue();
char temperature10[3];
float temp10 = (SENS_1_TMP + (SENS_2_TMP - SENS_1_TMP) / (SENS_2_VAL - SENS_1_VAL) * (sensorValue10 - SENS_1_VAL))-2;
dtostrf(temp10, 0, 1, temperature10);

int sensorValue11 = analog11.getValue();
char temperature11[3];
float temp11 = (SENS_1_TMP + (SENS_2_TMP - SENS_1_TMP) / (SENS_2_VAL - SENS_1_VAL) * (sensorValue11 - SENS_1_VAL))-2;
dtostrf(temp11, 0, 1, temperature11);

int sensorValue12 = analog12.getValue();
char temperature12[3];
float temp12 = (SENS_1_TMP + (SENS_2_TMP - SENS_1_TMP) / (SENS_2_VAL - SENS_1_VAL) * (sensorValue12 - SENS_1_VAL))-2;
dtostrf(temp12, 0, 1, temperature12);

int sensorValue13 = analog13.getValue();
char temperature13[3];
float temp13 = (SENS_1_TMP + (SENS_2_TMP - SENS_1_TMP) / (SENS_2_VAL - SENS_1_VAL) * (sensorValue13 - SENS_1_VAL))-2;
dtostrf(temp13, 0, 1, temperature13);

int sensorValue14 = analog14.getValue();
char temperature14[3];
float temp14 = (SENS_1_TMP + (SENS_2_TMP - SENS_1_TMP) / (SENS_2_VAL - SENS_1_VAL) * (sensorValue14 - SENS_1_VAL))-2;
dtostrf(temp14, 0, 1, temperature14);

int sensorValue15 = analog15.getValue();
char temperature15[3];
float temp15 = (SENS_1_TMP + (SENS_2_TMP - SENS_1_TMP) / (SENS_2_VAL - SENS_1_VAL) * (sensorValue15 - SENS_1_VAL))-2;
dtostrf(temp15, 0, 1, temperature15);
*/

if (millis() - lastMillis > 5000){
client.publish("arduino01/pin0", temperatureZero);
client.publish("arduino01/pin1", temperature1);
client.publish("arduino01/pin2", temperature2);
//client.publish("arduino01/pin3", temperature3);
//client.publish("arduino01/pin4", temperature4);
//client.publish("arduino01/pin5", temperature5);
//client.publish("arduino01/pin6", temperature6);
//client.publish("arduino01/pin7", temperature7);
//client.publish("arduino01/pin8", temperature8);
//client.publish("arduino01/pin9", temperature9);
//client.publish("arduino01/pin10", temperature10);
//client.publish("arduino01/pin11", temperature11);
//client.publish("arduino01/pin12", temperature12);
//client.publish("arduino01/pin13", temperature13);
//client.publish("arduino01/pin14", temperature14);
//client.publish("arduino01/pin15", temperature15);
Serial.println(temperatureZero);
Serial.println(temperature1);
Serial.println(temperature2);
//Serial.println(temperature3);
//Serial.println(temperature4);
//Serial.println(temperature5);
//Serial.println(temperature6);
//Serial.println(temperature7);
//Serial.println(temperature8);
//Serial.println(temperature9);
//Serial.println(temperature10);
//Serial.println(temperature11);
//Serial.println(temperature12);
//Serial.println(temperature13);
//Serial.println(temperature14);
//Serial.println(temperature15);
lastMillis = millis();
}

client.loop();

}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.