Question 1 for Embed Lab

Dependencies:   mbed

Committer:
t00214916
Date:
Mon Aug 16 16:47:23 2021 +0000
Revision:
0:0cbd2a7185e7
Child:
1:780300dcee8d
Final Code

Who changed what in which revision?

UserRevisionLine numberNew contents of line
t00214916 0:0cbd2a7185e7 1 #include "mbed.h"
t00214916 0:0cbd2a7185e7 2
t00214916 0:0cbd2a7185e7 3 InterruptIn up (p15);
t00214916 0:0cbd2a7185e7 4 InterruptIn down (p12);
t00214916 0:0cbd2a7185e7 5 InterruptIn left (p13);
t00214916 0:0cbd2a7185e7 6 InterruptIn right (p16);
t00214916 0:0cbd2a7185e7 7 InterruptIn center (p14);
t00214916 0:0cbd2a7185e7 8
t00214916 0:0cbd2a7185e7 9 void Up (){
t00214916 0:0cbd2a7185e7 10
t00214916 0:0cbd2a7185e7 11 printf("Up\r\n");
t00214916 0:0cbd2a7185e7 12
t00214916 0:0cbd2a7185e7 13 }
t00214916 0:0cbd2a7185e7 14
t00214916 0:0cbd2a7185e7 15 void Down (){
t00214916 0:0cbd2a7185e7 16
t00214916 0:0cbd2a7185e7 17 printf("Down\r\n");
t00214916 0:0cbd2a7185e7 18
t00214916 0:0cbd2a7185e7 19 }
t00214916 0:0cbd2a7185e7 20
t00214916 0:0cbd2a7185e7 21 void Left (){
t00214916 0:0cbd2a7185e7 22
t00214916 0:0cbd2a7185e7 23 printf("Left\r\n");
t00214916 0:0cbd2a7185e7 24
t00214916 0:0cbd2a7185e7 25 }
t00214916 0:0cbd2a7185e7 26
t00214916 0:0cbd2a7185e7 27 void Right (){
t00214916 0:0cbd2a7185e7 28
t00214916 0:0cbd2a7185e7 29 printf("Right\r\n");
t00214916 0:0cbd2a7185e7 30
t00214916 0:0cbd2a7185e7 31 }
t00214916 0:0cbd2a7185e7 32
t00214916 0:0cbd2a7185e7 33 void Center (){
t00214916 0:0cbd2a7185e7 34
t00214916 0:0cbd2a7185e7 35 printf("Center\r\n");
t00214916 0:0cbd2a7185e7 36
t00214916 0:0cbd2a7185e7 37 }
t00214916 0:0cbd2a7185e7 38
t00214916 0:0cbd2a7185e7 39 int main() {
t00214916 0:0cbd2a7185e7 40
t00214916 0:0cbd2a7185e7 41 up.rise (&Up);
t00214916 0:0cbd2a7185e7 42 down.rise (&Down);
t00214916 0:0cbd2a7185e7 43 left.rise (&Left);
t00214916 0:0cbd2a7185e7 44 right.rise (&Right);
t00214916 0:0cbd2a7185e7 45 center.rise (&Center);
t00214916 0:0cbd2a7185e7 46 }
t00214916 0:0cbd2a7185e7 47