![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
02/07/15
Dependencies: mbed
main.cpp@69:74bffa1d3f7f, 2015-08-27 (annotated)
- Committer:
- aidanPJG
- Date:
- Thu Aug 27 14:32:20 2015 +0000
- Revision:
- 69:74bffa1d3f7f
- Parent:
- 68:c6399471ea49
- Child:
- 70:168d67695a65
working well multiple times. resets gui view
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ADAMSTRUTT | 17:d9fb4a3780c7 | 1 | #include "mbed.h" |
ADAMSTRUTT | 17:d9fb4a3780c7 | 2 | #include "Calculate.h" |
ADAMSTRUTT | 35:085a674c9fdf | 3 | #include "Data.h" |
aidanPJG | 48:e9578f56534a | 4 | #include "UserInput.h" |
aidanPJG | 56:bf08d9e50ccc | 5 | #include "AddDetails.h" |
ADAMSTRUTT | 35:085a674c9fdf | 6 | |
aidanPJG | 25:bab86a12e9ad | 7 | Serial pc(USBTX, USBRX); // tx, rx |
aidanPJG | 59:2cbbd6fea55b | 8 | DigitalOut led1(LED1); |
aidanPJG | 59:2cbbd6fea55b | 9 | DigitalOut led2(LED2); |
aidanPJG | 65:08b3eb9b95dd | 10 | string handshake(); |
aidanPJG | 59:2cbbd6fea55b | 11 | void run(); |
aidanPJG | 68:c6399471ea49 | 12 | int listen(); |
ADAMSTRUTT | 17:d9fb4a3780c7 | 13 | |
ADAMSTRUTT | 20:0b2279011691 | 14 | int main(void) |
aidanPJG | 7:d6f78ba7c5f7 | 15 | { |
aidanPJG | 68:c6399471ea49 | 16 | |
aidanPJG | 65:08b3eb9b95dd | 17 | if (handshake() == "success") |
aidanPJG | 65:08b3eb9b95dd | 18 | { |
aidanPJG | 65:08b3eb9b95dd | 19 | run(); |
aidanPJG | 65:08b3eb9b95dd | 20 | } |
aidanPJG | 65:08b3eb9b95dd | 21 | led2= 1; |
aidanPJG | 59:2cbbd6fea55b | 22 | } |
aidanPJG | 68:c6399471ea49 | 23 | |
aidanPJG | 65:08b3eb9b95dd | 24 | string handshake() |
aidanPJG | 59:2cbbd6fea55b | 25 | { |
aidanPJG | 59:2cbbd6fea55b | 26 | unsigned char input; |
aidanPJG | 59:2cbbd6fea55b | 27 | pc.printf("a\n"); |
aidanPJG | 59:2cbbd6fea55b | 28 | |
aidanPJG | 59:2cbbd6fea55b | 29 | while(true) |
aidanPJG | 59:2cbbd6fea55b | 30 | { |
aidanPJG | 59:2cbbd6fea55b | 31 | input = pc.getc(); |
aidanPJG | 59:2cbbd6fea55b | 32 | if (input == 'a') |
aidanPJG | 59:2cbbd6fea55b | 33 | { |
aidanPJG | 66:b642dac6f65d | 34 | led1 = 1; |
aidanPJG | 65:08b3eb9b95dd | 35 | return "success" ;// run(); |
aidanPJG | 59:2cbbd6fea55b | 36 | } |
aidanPJG | 59:2cbbd6fea55b | 37 | } |
aidanPJG | 59:2cbbd6fea55b | 38 | } |
aidanPJG | 59:2cbbd6fea55b | 39 | void run() |
aidanPJG | 59:2cbbd6fea55b | 40 | { |
aidanPJG | 55:58e9836f5ad1 | 41 | int pins = inputNoOfPins(); //gets number of pins |
aidanPJG | 55:58e9836f5ad1 | 42 | double distance = inputDistance(); //gets the distance between the pins |
aidanPJG | 59:2cbbd6fea55b | 43 | calculate(distance,pins); |
aidanPJG | 59:2cbbd6fea55b | 44 | } |