ECE595 - Lab 3 Part 2 - Grove Vibration Motor Program - TA

Files at this revision

API Documentation at this revision

Comitter:
priyank12p
Date:
Sat Jan 16 00:19:21 2021 +0000
Parent:
2:af5f9d175643
Commit message:
Initial Commit

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Sat Jan 16 00:15:29 2021 +0000
+++ b/main.cpp	Sat Jan 16 00:19:21 2021 +0000
@@ -1,13 +1,12 @@
 #include "mbed.h"
-DigitalIn button(D2);
+DigitalOut vibMotor(D6);
 
 int main (void) { 
-    int cnt = 0;
+    int timer = 1;
     while(1) {
-        if (button) {
-            cnt++;
-            printf("Touch detected %d\n", cnt);
-            while(button);
-        }
+        vibMotor = 1;
+        wait(timer);
+        vibMotor = 0;
+        wait(timer);
     }
 }
\ No newline at end of file