microbit servomoottori potentiometrillä ohjattuna servomotor controlled by potentiometer
main.cpp
- Committer:
- tyynetyyne
- Date:
- 2018-05-24
- Revision:
- 0:92e407c147da
File content as of revision 0:92e407c147da:
#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); } }