Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 2:3f95c82c26bb
- Parent:
- 1:0191658b6ff4
- Child:
- 3:4249dbdf7ed3
--- a/main.cpp Wed Oct 24 15:01:11 2018 +0000
+++ b/main.cpp Fri Oct 26 12:58:15 2018 +0000
@@ -16,14 +16,16 @@
DigitalOut Phase3 (p23);
DigitalOut Phase4 (p24);
-InterruptIn ChannelA (p5);
-InterruptIn ChannelB (p6);
-InterruptIn Index (p8);
+InterruptIn ChannelA (p5);
+InterruptIn ChannelB (p6);
+InterruptIn Index (p8);
-DigitalOut led1(LED1);
-DigitalOut led2(LED2);
-DigitalOut led3(LED3);
-DigitalOut led4(LED4);
+DigitalIn Button1 (p11);
+
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+DigitalOut led3(LED3);
+DigitalOut led4(LED4);
int CountA=0; //On start up the integer will be zero
int CountB=0;
@@ -38,29 +40,38 @@
Index.rise(&ReportX); // Interrupt - When Index goes from 0 to 1 it is reported
pc.baud(230400); //Set fastest baud rate
Startup();
+
- while(CountX==3)
+ while(CountX>0)
{
- wait(0.5);
+ wait(1);
pc.printf("A = %d\n\r",CountA);
pc.printf("B = %d\n\r",CountB);
+ while(Button1);
wait(0.5);
Ph1();
- wait(0.5);
+ led1=!led1;
+ wait(1);
pc.printf("A = %d\n\r",CountA);
pc.printf("B = %d\n\r",CountB);
+ while(Button1);
wait(0.5);
Ph2();
- wait(0.5);
+ led2=!led2;
+ wait(1);
pc.printf("A = %d\n\r",CountA);
pc.printf("B = %d\n\r",CountB);
+ while(Button1);
wait(0.5);
Ph3();
- wait(0.5);
+ led3=!led3;
+ wait(1);
pc.printf("A = %d\n\r",CountA);
pc.printf("B = %d\n\r",CountB);
+ while(Button1);
wait(0.5);
Ph4();
+ led4=!led4;
}
}
@@ -79,7 +90,7 @@
void ReportA(void)
{
CountA++;
-led1 = !led1; //Counts A
+//led1 = !led1; //Counts A
//pc.printf("A = %d\n\r",CountA); //Prints cumulative counts to Terraterm
}
@@ -87,7 +98,7 @@
void ReportB(void)
{
CountB++;
-led2 = !led2; //Counts B
+//led2 = !led2; //Counts B
//pc.printf("B = %d\n\r",CountB); //Prints cumulative counts to Terraterm
}
@@ -97,7 +108,7 @@
{
CountX++;
pc.printf("X = %d\n\r",CountX); //Prints cumulative counts to Terraterm
- led4 = !led4;
+ //led4 = !led4;
CountA = CountB = 0;
}