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.
10 years, 5 months ago.
Why won't this compile and run ?
Please bare with me, I'm very new to this.
My teacher college needs us to write a program that functions like a two input AND gate. I've written it in C++ Visual Studio fine, but I'm having trouble getting it to work for the mbed.
I need some help please...
Here's my code:
- include "mbed.h"
DigitalIn a(p5); Get a value form pin 5 DigitalIn b(p6); Get a value form pin 6
Deculations (For the Internal lgoic) int f;
f = (a & b); AND Gate 1
DigitalOut f_ AND(LED1);
int main() { while(1) {
f_AND = (a & b) } }
1 Answer
10 years, 5 months ago.
Put your code between code tags (<<code>> and <</code>>
), now it is not really readable. Also when you say it doesn't compile it is useful to mention which error message you get. For sure you seem to be missing a ';' at the f_AND = declaration.
Also f = (a & b) seems to be a bit lost.