microbit servomoottori potentiometrillä ohjattuna servomotor controlled by potentiometer

Dependencies:   microbit

Revision:
0:92e407c147da
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);
+    }
+}
+
+