Problems compiling seeed xiao with arduino

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 :

const int led = D1;
char incoming_value = 0;

void setup() {

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;
exit status 1
‘D1’ was not declared in this scope”

instead of
const int led = D1;
how about
const int led = 1;

1 Like

Im still new but i thought defining between d1 and a1 will change the pin from digital to analog wont it?

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 & 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);

1 Like

Thank you! The seeed is powerful but im still trying to master it,alot of similarities but differences to other arduino type boards

Its just a little confusing why name the same pin “D1” and “A1” instead of just one or the other on the data sheet

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.

1 Like