Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
5 years, 11 months ago.
DigitalOut read() method
Hi,
I've just started playing with F303K8 Nucleo board.
I tried to modify the blink example as follows:
#include "mbed.h" DigitalOut myled(D4,0); DigitalOut t(D5,0); int main() { while(1) { myled.write(1); // LED is ON int k=myled.read(); t.write(k); wait(1.0); // 1s myled.write(0); // LED is OFF k=myled.read(); t.write(k); wait(1.0); // 1 sec } }
The problem is that k is 0 when myled is on and 1 when myled is off.
Can you help me ?
Thanks in advance !
1 Answer
5 years, 10 months ago.
Hello there,
It could be that that board was made active low (i.e. LED is on when it is set to 0 and vice versa). Hope this helps!
-Karen, team Mbed
I've tested with Nucleo f103rb and ir works as it should. So maybe is something related to the board.
posted by P. Xrist 28 May 2018