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.
Dependencies: GoalCounter WS2812 PixelArray
Diff: main.cpp
- Revision:
- 3:d74c47d2e933
- Parent:
- 2:f04959a6fd61
- Child:
- 4:5a11a84fac69
--- a/main.cpp Fri Jan 11 18:29:58 2019 +0000
+++ b/main.cpp Sat Jan 12 18:50:49 2019 +0000
@@ -9,6 +9,12 @@
#define COLOR 0x2f2020
#define DEBUG 1
+#define MBED_CONF_PLATFORM_FORCE_NON_COPYABLE_ERROR 0
+
+//Initialize instances of Timers
+//Timer t1;
+//Timer t2;
+
// Initialize instace of a pixel array for LED strip 1 ar 2
PixelArray px1(WS2812_BUF);
PixelArray px2(WS2812_BUF);
@@ -17,9 +23,14 @@
WS2812 ws1(D4, WS2812_BUF, 0, 5, 5, 0);
WS2812 ws2(D5, WS2812_BUF, 0, 5, 5, 0);
+// Initialize interrupt classes
+//InterruptIn i1(D2);
+//InterruptIn i2(D3);
// Initialize instances of GoalCounter classes for counting goals
-GoalCounter gc1(D2);
-GoalCounter gc2(D3);
+//GoalCounter gc1(D2, i1);
+//GoalCounter gc2(D3, i2);
+
+GoalCounter gc(D2, D3);
// Initialize instances of Ticker classes for handling goal counters
//Ticker bank1;
@@ -59,7 +70,7 @@
*score = gc.get_score();
*balltime = gc.get_balltime();
*speed = gc.get_ballspeed();
- gc.is_goal = 0;
+ gc.is_goal1 = 0;
}
int main()
@@ -74,17 +85,17 @@
// bank2.attach(&print_info, 0.5);
while(1) {
- if (gc1.is_goal) {
- get_info(&score1, &balltime1, &speed1, gc1);
+ if (gc.is_goal1) {
+ get_info(&score1, &balltime1, &speed1, gc);
set_score(score1, px1, ws1);
if (DEBUG)
print_score(score1, balltime1, speed1);
}
- else if (gc2.is_goal) {
- get_info(&score2, &balltime2, &speed2, gc2);
- set_score(score2, px2, ws2);
- if (DEBUG)
- print_score(score2, balltime2, speed2);
- }
+// else if (gc2.is_goal) {
+// get_info(&score2, &balltime2, &speed2, gc2);
+// set_score(score2, px2, ws2);
+// if (DEBUG)
+// print_score(score2, balltime2, speed2);
+// }
}
}