Go Down

Topic: What actually happened? Urgent! (Read 114 times) previous topic - next topic

Ch-Walid

Hi,

At first I used Arduino to just run simple codes like this one:

void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
Serial.println("Walid");
}


And upload it to arduino and run it on serial monitor. But then I wrote a code :

void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
pinMode (A5,INPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  int pot = analogRead (A5);
Serial.println(pot);
}


and connected a potentio-meter at A5 and the side pins with 5 volts and ground. And it worked! I could see the values changing on serial monitor. But when I increased it to the max 1023 after a couple of seconds the software gave me an error saying :



Arduino: 1.8.2 (Windows 10), Board: "Arduino/Genuino Uno"

Sketch uses 1864 bytes (5%) of program storage space. Maximum is 32256 bytes.
Global variables use 186 bytes (9%) of dynamic memory, leaving 1862 bytes for local variables. Maximum is 2048 bytes.
avrdude: ser_open(): can't open device "\\.\COM7": The system cannot find the file specified.


Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.




So, now I don't know what to do. Can you please help me with this issue?

Regards,

sterretje

First simple test, check if the correct port is selected in the IDE.

Which Arduino? Original or clone?

Check Windows' device manager if something changes when you connect/disconnect the arduino. Check the driver when the arduino is connected.
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

olf2012

and BTW you do not need to call pinMode. analogRead handles this automatically AND the pin defaults to input after startup anyway

Go Up