11 years, 9 months ago.

DigitalOut

I need to switch PTE20 to PTE39 pins on and off.

I am new to mbed so help me to code this .

When I use DigitalOut myled(p5);

I get the error "identifier "p5" is undefined" in file "/main.cpp", Line: 3, Col: 17

How do I switch the required pins

Thanks

Kaysee

Question relating to:

2 Answers

11 years, 9 months ago.

Hi, Kesara this is a little example to turn on and off a led connected to pin p5:

#include "mbed.h"

DigitalOut myled(p5);

int main() {        
    while(1) {
        myled = 1;
        wait(0.2);
        myled = 0;
        wait(0.2);
    }
}

I hope this will help you

Greetings

I still get this error "identifier "p5" is undefined" in file "/main.cpp", Line: 3, Col: 17

posted by Kesara De Costa 19 Mar 2013
11 years, 9 months ago.

You are using the Freescale board, which doesnt have a p5, which results in that error. Replace p5 with the pin you use, for example PTE20.