![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
02/07/15
Dependencies: mbed
main.cpp
- Committer:
- aidanPJG
- Date:
- 2015-07-01
- Revision:
- 4:e61cd14ec4f0
- Parent:
- 3:1ef4740c5a64
- Child:
- 7:d6f78ba7c5f7
File content as of revision 4:e61cd14ec4f0:
#include "mbed.h" #include <time.h> #include <string> #include <iostream> Serial pc(USBTX, USBRX); // tx, rx //defines the communication between MBed and pc DigitalIn input(p8); //input from diode. Digital 1 is beam unbroken? DigitalOut led(LED1); //testing purposes int main() { int line = 0; //line counter pc.printf("new program \n"); //lert user of initialisation while(1) { //loops continuously if (input) //checks the digital input from the diode. { pc.printf("Message %d : \t", line); pc.printf("DigitalIn: 1 \n"); led = 1; line = line + 1; } else { pc.printf("Message %d : \t", line); pc.printf("DigitalIn 0\n"); led = 0; line = line + 1 ; } } }