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.

http://support.sodaq.com/sodaq-one/mbili/pin-io-theory/

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);
or
pinMode(LED_RED, 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 http://support.sodaq.com/sodaq-one/sodaq-one/
and scroll down to: pin definitions to see all the names.

Kind regards,
Jan

Ok as i thought.

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

pinMode(14, INPUT);
or
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.

/Håkan

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,
Jan

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