Using I/O ports for custom input for example ultrasonic

So im thinking of buying a sodaq one but cant find any information of how to use for example a ultrasonic sensor with the board. For the mbili it’s clear defined how you define the I/O ports for input or output.

But what about the Sodaq one? Are there any examples?

Regards Håkan

Hi @Hakan_Eriksson,

How you define the I/O pins is the same for the mbili and for the one.

The good thing about the sodaq one is that you can use all I/O for Analog or Digital.
Some of our boards have the same components like the RGB LED.

You can use:
pinMode(14, OUTPUT);

Both will do the same, I recomment to use the pin name.
If you want to use the same code on an sodaq explorer LED_RED is also there, just not on pin 14.

Go to
and scroll down to: pin definitions to see all the names.

Kind regards,

Ok as i thought.

So just to be clear i can do this in other words.

pinMode(14, INPUT);
pinMode(LED_RED, INPUT);

I think i might have the answer myself about ultrasonic sensor as i need both echo and signal for the ultrasonicsensor, so one pin for trigger (OUTPUT) and one pin for echo (INPUT).

PLease verify if im on the right track.


Hi @Hakan_Eriksson

Yes you can do that.

Also the pins can be used as analog input/output
pinMode(14, INPUT); // digital input
pinMode(A14, INPUT); // analog input

Use the correct debug output.
Serial.print will print to D0/D1
SerialUSB.print will print on the usb

Kind regards,

That sounds great!

Thanks for the help!

I feel i now have the answers to my questions to proceed with the investment of my first sodaq one!

Regards Håkan