ZJ0518
Newbie
Hi, I faced such issue while uploading my code from arduino IDE to my NODEMCU Lua V3 ESP8266 WIFI.
Error:
This is my code to interface the Ultrasonic Sensor and NodeMCU.
Error:
Code:
Executable segment sizes:
IROM : 248372 - code in flash (default or ICACHE_FLASH_ATTR)
IRAM : 27960 / 32768 - code in IRAM (ICACHE_RAM_ATTR, ISRs...)
DATA : 1320 ) - initialized variables (global, static) in RAM/HEAP
RODATA : 2224 ) / 81920 - constants (global, static) in RAM/HEAP
BSS : 25552 ) - zeroed variables (global, static) in RAM/HEAP
Sketch uses 279876 bytes (26%) of program storage space. Maximum is 1044464 bytes.
Global variables use 29096 bytes (35%) of dynamic memory, leaving 52824 bytes for local variables. Maximum is 81920 bytes.
esptool.py v2.8
Serial port COM4
Traceback (most recent call last):
File "C:\Users\Zhang Jie\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4/tools/upload.py", line 65, in <module>
esptool.main(cmdline)
File "C:/Users/Zhang Jie/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/esptool\esptool.py", line 2889, in main
esp = chip_class(each_port, initial_baud, args.trace)
File "C:/Users/Zhang Jie/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/esptool\esptool.py", line 237, in __init__
self._port = serial.serial_for_url(port)
File "C:/Users/Zhang Jie/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/pyserial\serial\__init__.py", line 88, in serial_for_url
instance.open()
File "C:/Users/Zhang Jie/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/pyserial\serial\serialwin32.py", line 78, in open
self._reconfigure_port()
File "C:/Users/Zhang Jie/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/pyserial\serial\serialwin32.py", line 222, in _reconfigure_port
'Original message: {!r}'.format(ctypes.WinError()))
serial.serialutil.SerialException: Cannot configure port, something went wrong. Original message: PermissionError(13, 'A device attached to the system is not functioning.', None, 31)
serial.serialutil.SerialException: Cannot configure port, something went wrong. Original message: PermissionError(13, 'A device attached to the system is not functioning.',
This is my code to interface the Ultrasonic Sensor and NodeMCU.
C:
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "-2fX0ap9fZmfV1sZLpw06ab6WNvagomb";
char ssid[] = "BlazingSpeed-TIME2.4G";
char pass[] = "1bwf3988";
const int trigPin = D0;
const int echoPin = D1;
long duration;
int distance;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Blynk.begin(auth,ssid,pass);
pinMode(trigPin,OUTPUT);
pinMode(echoPin,INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(trigPin,LOW);
delayMicroseconds(2);
digitalWrite(trigPin,HIGH);
delayMicroseconds(10);
digitalWrite(trigPin,LOW);
duration = pulseIn(echoPin,HIGH);
distance = duration*0.34/2;
if (distance <= 10){
Blynk.virtualWrite(V0,255);
}
else{
Blynk.virtualWrite(V0,0);
}
if (distance <= 6){
Blynk.virtualWrite(V1,255);
}
else{
Blynk.virtualWrite(V1,0);
}
if (distance <= 3){
Blynk.virtualWrite(V2,255);
}
else{
Blynk.virtualWrite(V2,0);
}
Blynk.run();
}
Last edited by a moderator: