The following are my code:
#include <SPI.h>
int sensor1 = A0 ;//the port of the sensor's connected to on Arduino UNO
void setup() {
Serial.begin(115200);
delay(10);
}
void loop() {
int voltage = 0;
int sensorValue = analogRead(sensor2);
float voltage = sensorValue * (5.0 / 1024.0);
Serial.println(voltage);
Serial.print(" Turbidity:");
Serial.println(voltage);
delay(3000);
}
My connections:
RX>>RX//what's working for me
TX>>TX
VCC,CH_PD>>3.3v
GPIO0>>Ground
GND>>Ground
RST,GPIO2>>not connected
Sensor's connected to A0, 5v and GND of Arduino UNO.