HOWDY ALL,i have a problem when declaring the seeed xiao pins as global variables before assigning pin type and status, i dont know why? ive used other boards with no problems,Ive looked at the XIAO data sheet and have used the exact terminology they use when they named their pins.
WHAT I AM TRYING TO DO is simply define a pin “D1” of the XIAO like this :
BUT whenever i try to compile it gives me a ERROR(listed below) i have tried also as “const int” and also jsut regular “int” but it makes no difference when ever i define the pin as “A1” instead of “D1” it does complile but i do not want to call the pin as a analog pin i want it to be defined and function as a digital only.can someone please help? thank you in advance! =)
“ino:1:17: note: suggested alternative: ‘A1’
const int led = D1;
^~
A1
exit status 1
‘D1’ was not declared in this scope”
One step at a time. Did the above suggestion result in a successful compile ?
I don’t think just defining between d1 and a1 will change the pin from digital to analog. There are different functions involved.
Go to https://www.arduino.cc/reference/en/ & look at the examples in the Digital I/O & Analog I/O sections.
C won’t allow const int led = D1; cause D1 is not an integer
Don’t know why it will allow const int led = A1; some Arduino thing I guess sure not standard C.
You could always do
#define D1 1 // note no semi-colon
pinMode(D1, OUTPUT);
Flexibility, it can be either a D or an A depending on what you tell the code to do with it. Today it’s a D output used to flash a LED, next project you decide it’s an A input used to read your battery voltage. Many many many layers in HW and SW thankfully hidden from us, the end user.
The alternative is, instead of a 14 pin device, maybe a power hungry 60 pin device with a large part of them to be manipulated in configuration changes from D to A and Input to Output.