Send data from Arduino using ESP8266 (please help, beginner here)

I’m a beginner at this, so please bear with me.

I have two IR sensors connected to an Arduino Uno, which I am using as a counter. The sketch for the counter is working as expected. The Arduino prints the counter value in the serial monitor.

const int sensorPin = A1;    // pin that the sensor is attached to
int sensA;                      //    Declaring VARIABLES
int thresh;
int ctr=0;
int state=LOW;
int lastState=LOW;
int count=0;
void setup()
{

Serial.begin(9600);
pinMode(4, INPUT);
pinMode(A1, OUTPUT);
state=digitalRead(4);
}

void loop() 
{
sensA = analogRead(sensorPin);        // READ SENSOR
thresh = 835;                  //  CHANGE THE VALUE OF THRESHOLD ACCORDING TO THE AMBIENT LIGHT
if(sensA<thresh)
{
ctr=1;                                      
delay(1);

if (state==HIGH && lastState==LOW){
count++;
Serial.println(count);
analogWrite(A0, count);
}
lastState=state;
state=digitalRead(4);
delay(10);
}
else{ctr=0;
count=0;

}

}

I now need the ESP8266-01 to read the counter value (maybe from the Serial Monitor, I don’t really know), and send it to a dashboard online. I’m using Ubidots for this.

I used Ubidots’ tutorial (Link: https://ubidots.com/docs/devices/ESP8266-arduino.html) but the ESP is sending -1 only.

#include <UbidotsMicroESP8266.h>
#include <SoftwareSerial.h>

#define _rxpin      2
#define _txpin      3
SoftwareSerial readerSerial( _rxpin, _txpin ); // RX, TX

#define SSID "SSID"
#define PASS "PASSWORD"

#define TOKEN "token"
#define ID "variableID" // Replace it with your Ubidots' variable ID

Ubidots client(TOKEN);

void setup() {
  Serial.begin(9600);
  client.wifiConnection(SSID,PASS);
}
void loop() {
 
  float value = Serial.read();
  client.add(ID,value);
  client.sendAll();
  delay(1000);
}

Can you please tell me how to go about this? I am new to this (clearly) so I don’t know what to do next. Is there some other way to get the ESP to read the Arduino output?

The variable names in your code make little sense. It is not clear WHAT you are counting.

You mention two IR sensors, but you only read one analog device.

Your indenting and code layout is atrocious. Put EVERY { on a line BY ITSELF. Put EVERY } on a line BY ITSELF. Use Tools + Auto Format to properly indent the code.

I now need the ESP8266-01 to read the counter value (maybe from the Serial Monitor

The ESP can not read what the Arduino writes to the serial port. On the other hand, the input to the ESP could be the output from the Arduino. Connect the ESP to the RX and TX pins of the Arduino.

The Arduino is using print() to send data to the serial. It is, therefore, sending TEXT to the serial port, NOT floats.

The Serial.read() method returns an int, containing one character OR an error value (-1) that says there was nothing to read.

Read this: http://forum.arduino.cc/index.php?topic=396450.0 to learn how to read serial data, and, of course, how to properly send serial data.

You should learn the basics, like how to swim, before jumping into the shark-infested deep end.