Arduino nano isn't running my code

I bought an Arduino Nano today, but it doesnt seem to be showing up very easily in the IDE software. I think I found the correct port, and there are no errors with the code or the uploading process. Yet for some reason the board doesnt run the code. The power is the only light that is working on it, glowing a constant red. Is this a cable issue? I tried two cables and neither worked.

Hi! Welcome to the Forum.

Can you show a picture of both sides of your Nano?

Why am I asking?

→ There are many types of Nano. The most common is the Classic Nano.

→ Many classic Nanos are Clones, which have a CH340 chip as the USB-Serial converter. This chip needs a driver to be installed on Windows.

Welcome to the forum

If the code compiles and uploads without error then it is not a problem with the cable.

Please post your full sketch, using code tags when you do

Posting your code using code tags prevents parts of it being interpreted as HTML coding and makes it easier to copy for examination

In my experience the easiest way to tidy up the code and add the code tags is as follows

Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.

Bearing in mind that you're the only one who can see what your Nano is and isn't doing, how, exactly, are you determining that it isn't running your code?

And also, bear in mind that code that compiles and uploads doesn't do what you think it should do, but what you told it to do. Which are quite often two completely different things.

Which is why you should always, always, show your complete code, formatted with the <CODE/> toolbar tool.

Please explain.

Maybe a bad cable.

The IDE only knows about ports that the operating system recognises. So if you have problems you'll have to look at the operating system level (Windows device manager, Linux lsusb and dmesg).

Does it disappear when you disconnect the board? If not, it's not the Nano. But if uploads seem to succeed it is the correct port (unless you have multiple boards connected).