so today i wanted to create smthing like calculator in serial monitor, and tried this code by chatgpt
const int buttonPin = 2; // пин, к которому подключена вторая провода
int buttonState = 0;
void setup() {
pinMode(buttonPin, INPUT_PULLUP); // Включаем внутренний подтягивающий резистор
Serial.begin(9600);
}
void loop() {
buttonState = digitalRead(buttonPin);
if (buttonState == LOW) { // контакты соединены (пин замкнут на GND)
Serial.println("Кнопка нажата (контакты соединены)");
// здесь можно включить светодиод или вызвать другую функцию
} else {
Serial.println("Кнопки не нажаты");
}
delay(200);
}
so now i cant upload any other code, and burn a bootloader, and everything, tried resetting, and i need yours help cuz i want to reset it (or smthing like that) so no code runs
(sorry for bad english)
cant upload, it just gives this error:
Скетч использует 444 байт (1%) памяти устройства. Всего доступно 30720 байт.
Глобальные переменные используют 9 байт (0%) динамической памяти, оставляя 2039 байт для локальных переменных. Максимум: 2048 байт.
avrdude: ser_open(): can't open device "\.\COM3": �������� � �������.
Check the COM port setting in Tools/Port (the \.\ part is suspicious). If the port really exist and is selected, then try press RESET button on the Arduino, start uploading and immediately release the RESET button.
tried it and after several attempts it give this coman
C:\windows\temp\ccfq42Ye.ltrans0.ltrans.o: In function main': C:\Users\User\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino/main.cpp:43: undefined reference to setup'
collect2.exe: error: ld returned 1 exit status
exit status 1
Just indicates you've got something in the running code doing a Serial.write() or Serial.print(). Which you do.
But your error message makes me think you've got a bad USB cable, or other basic connectivity problem. Unplug, replug your USB cable, both ends, one at a time, trying your compile/upload between each change, and report back.
You've posted in the Every category - do you really have a genuine Nano Every? New visitors often post in the wrong category.
Also, one common newbie error is for the pins on the Arduino to have been pushed into the holes, but not soldered - could you post a picture of your setup, please? If they're not soldered, they will make contact, but not reliably. You might go for hours with successful uploads, then suddenly, nothing, then something, then nothing, etc.
Скетч использует 444 байт (1%) памяти устройства. Всего доступно 30720 байт.
Глобальные переменные используют 9 байт (0%) динамической памяти, оставляя 2039 байт для локальных переменных. Максимум: 2048 байт.
The sketch uses 444 bytes (1%) of device memory. The total available memory is 30,720 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2,039 bytes for local variables. Maximum: 2,048 bytes.
Based on the memory usage reported by the IDE you're not using a Nano Every and therefore your topic has been moved a a more suitable location on the forum.
I unplug arduino out of pc, and plug back in, and then when it not runs any code upload new code on it, maybe it works, and again sorry for my bad english