You are viewing an older revision! See the latest version
Compiler Error 77 D
This can happen if you've put a statement (eg an assignment) outside of any function:
#include "mbed.h"
DigitalOut myled(LED1);
/* This will cause an error - statements must live inside functions */
myled =0 ;
int main() {
while(1) {
myled = 1;
wait(0.2);
myled = 0;
wait(0.2);
}
}
You can initialise variables either as part of their declaration:
... DigitalOut myled(LED1) = 0; ...
...or inside the main function:
#include "mbed.h"
DigitalOut myled(LED1);
int main() {
/* This will succeed */
myled =0 ;
while(1) {
myled = 1;
wait(0.2);
myled = 0;
wait(0.2);
}
}