I am trying to use LED2 or LED3 in Nucleo F401 board. I am getting error:
/src/main.cpp:3:18: error: unknown type name ‘LED2’
DigitalOut myled(LED2);
Also if I change it to LED1 the code is built, but that specific led doesn’t turn OFF instead it remains On all the time. Hope to get some help here. Thanks
I do not know what you mean but you need a .cpp file where the main function has to be and from user code starts. The name main.cpp it self is not important it is just for better orientation in project because when you see main.cpp then you know - “ok, here is the main function, here user code starts”.
If you want split your code in functions or classes in separete files, then you need another .h and .cpp files what will be included in the main file according to c++ standart.