Hi everyone:
Could someone help to getting Arduino UNO's board info programmatically, like Arduino IDE "Tools > Get Board Info" as image attached?
Regards...
Hi everyone:
Could someone help to getting Arduino UNO's board info programmatically, like Arduino IDE "Tools > Get Board Info" as image attached?
Regards...
You realize, of course, that the software that displayed that data runs on the PC, not on the Arduino. Right?
PaulS:
You realize, of course, that the software that displayed that data runs on the PC, not on the Arduino. Right?
I said I need information like it, not itself.
If Arduino IDE can read board info via USB, it may have Class/Function to read it inside code.
That information provided by Arduino Board, not OS.
Thank you.
Danois90:
Look at this
Thank you, but that's not.
lotfixyz:
Thank you, but that's not.
That's not what?
Danois90:
That's not what?
That's not what I need, where is the board's SN? A number like attachment!
The 'board info' is not a function of the compiler, but a parameter passed to it so that the appropriate board package can be loaded. As such, the pre-processor is aware of the board and defines a tag that will then be used to select the bsp. This tag can be queried in your code similar to,
#if defined (__AVR_ATmega328P__)
char BOARD[] = {"UNO"};
#elif defined (__AVR_ATmega2560__)
char BOARD[] = {"Mega"};
#elif defined (__AVR_ATmega168__)
char BOARD[] = {"Mini 168"};
#else
#warning "device type not defined"
#endif
All the bard tags can be found in io.h.
Zardof:
Try this linkG
Thanks, dear friend, but I need board's info (SN and ...), not board's "type".
Boards don't have a serial number.
DKWatson:
Boards don't have a serial number.
So what's the SN in Arduino IDE "Tools > Get Board Info" shows? :-/
Nothing.
The 32-bit processors and the new 328PB yes. Older release 8-bit processors no.
DKWatson:
Nothing.The 32-bit processors and the new 328PB yes. Older release 8-bit processors no.
Nothing???
What does it mean?
That's spurious??? That's not...
Clarification to previous statement, the xmega chips and the USB chips (AT90USBxxx) also do have.
AFAIK the serial number (from Board Info) is from the FTDI chip (USB/Serial interface) and not the Arduino which has no serial number.
Any device with built-in USB capabilities will have a serial number. This is part of the USB spec not the processor spec but by default, chips like the AT90 inherit the serial number from its USB.
DKWatson.
I know this is a very old thread, but I do have a question about what you posted that can get the board type, UNO, MEGA Mini 168, etc.
First, it works, but as I'm new to this indepth information, I wonder, how can we get info from a Nano.
When I run the #ifs, on a Nano, it comes up as UNO. Is there a way to find just Nano or are the UNO and Nano basically the same as each other as for wiring things up?
Or better yet, can you point me to where I can find the info like you posted, i.e.
AVR_ATmega328P
AVR_ATmega2560
AVR_ATmega168
So that I may learn how to find this info for other board and perhaps the Nano?
I'd really appreciate it.
Thanks in advance.
UNO and Nano is basically two form factors of the same device.
See https://www.microchip.com/ for datasheets on the various chips:
AVR_ATmega328P
AVR_ATmega2560
AVR_ATmega168
Uno and Nano both use '328P as the microcontroller, with the SMD Nano breaking out 2 analog input pins that the DIP Uno does not have pins for.
Uno use Atmega32U2, a re-programmable part for USB interface.
Nano use FTDI FT232, a dedicated part.