Light Sensor Test, Works on Genuino Uno but not on ESP8266!!
Posted: Sun Jan 21, 2018 4:07 pm
Basically what the title says!
I coded a light sensor test where it works on my Genuino Uno board and then tried on my ESP8266 V3 NodeMCU (http://www.smartarduino.com/nodemcu-bas ... 94571.html) and it gives me random stuff in the Serial Monitor. Am I doing something wrong or am I missing an information that I don't know about in ESP8266 that I can't do while it's allowed in Genuino Uno? Can someone please help me figure out with this stuff?
Thank you.
I coded a light sensor test where it works on my Genuino Uno board and then tried on my ESP8266 V3 NodeMCU (http://www.smartarduino.com/nodemcu-bas ... 94571.html) and it gives me random stuff in the Serial Monitor. Am I doing something wrong or am I missing an information that I don't know about in ESP8266 that I can't do while it's allowed in Genuino Uno? Can someone please help me figure out with this stuff?
Thank you.
Code: Select all
int sensorValue = 0;
int value = 0;
const int sensorPin = A0;
const int LEDPin = 8;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(LEDPin, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
sensorValue = analogRead(sensorPin);
delay(500);
Serial.print("Sensor Value: ");
Serial.println(sensorValue);
value = 255 - sensorValue/4;
Serial.print("Analog Value of Pin D8: ");
Serial.println(value);
analogWrite(LEDPin, value);
}