9 years ago.

How to use I/O pins for digitalout using the mbed compiler

Good Morning, I am aware that the code below sets up the LEDs for digital output

DigitalOut myled(LED1);

but I have 3 questions (FOR THE KL25Z BOARD)

1) what is the voltage of the DigitalOut?

2) what code do we need to use in order to access I/O pins?

i.e. DigitalOut myled(pinaddress)

3) what pins can I use?

1 Answer

9 years ago.

1) On most boards it will be 3.3v

2) myled = 1; switch led on myled = 0; switch led off

3) LED1 should be an LED on the board, but to use another pin without an attached LED, refer to the platforms page to see the pinout of your board, choose a pin and initialise with DigitalOut newled(pinname)

Accepted Answer

Thanks! for #3 I am using the freedom kl25z, when I look at the pin out nothing tells me which pins I can use as digitalout, just pmw and analog, can I use pmw as digitalout? also would the pinname be i.e. PTC4?

posted by Carlos Larco 14 Apr 2015

Yes I believe that is correct. You should be able to use most pwm pins as digital out too.

posted by Angus Richman 14 Apr 2015