microbit servomoottori potentiometrillä ohjattuna servomotor controlled by potentiometer

Dependencies:   microbit

Files at this revision

API Documentation at this revision

Comitter:
tyynetyyne
Date:
Thu May 24 09:33:31 2018 +0000
Commit message:
microbit servomotor with potentiometer

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
microbit.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 92e407c147da main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu May 24 09:33:31 2018 +0000
@@ -0,0 +1,21 @@
+
+#include "MicroBit.h"
+
+MicroBit uBit;
+int potikka = 0;
+int servo = 0;
+
+int main()
+{
+    uBit.init();
+    
+    while(1)
+    {
+    potikka = uBit.io.P1.getAnalogValue();   
+    servo = (int(potikka/1024.0*180));
+    uBit.io.P0.setServoValue(servo);         
+    uBit.sleep(100);
+    }
+}
+
+
diff -r 000000000000 -r 92e407c147da microbit.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/microbit.lib	Thu May 24 09:33:31 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/teams/Lancaster-University/code/microbit/#4b89e7e3494f