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.
9 years, 3 months ago.
Anyone knows what went wrong, tried compiling this for the FRDM K64F?
I tried running this code, in the K64 but I get a compilation error... Can anyone tell me what I have done wrong?
- include "mbed.h" int led[4] = {0,1,2,3}; int main() { for(int i=3; i<4; i++){ DigitalOut(led[i]); } while(1){ for(int i=3; i<4; i++){ led[i] = 1; } for(int i=3; i<4; i++){ led[i] = 0; } } }
Error: No default constructor exists for class "mbed::DigitalOut" in "main.cpp", Line: 6, Col: 21
I'm new to using the k64f, this program would run fine in an arduino....
Question relating to:
2 Answers
9 years, 3 months ago.
Hi Stive,
Please have a look on the page https://developer.mbed.org/handbook/DigitalOut
on how to use DigitalOut.
Also, like David said, please use code tags:
Code from Stive
#include "mbed.h" int led[4] = {0,1,2,3}; int main() { for(int i=3; i<4; i++) { DigitalOut(led[i]); } while(1) { for(int i=3; i<4; i++) { led[i] = 1; } for(int i=3; i<4; i++) { led[i] = 0; } } }
Regards, Miloje
Please use code tags, otherwise it is difficult to read your code.
posted by David Fletcher 27 Jul 2015