Advertisement
MekatroPedia

Motor Controlled with Arduino

Mar 18th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. #define MOF_PIN 6
  2. #define POT_PIN A1
  3.  
  4. int pot = 0;
  5.  
  6. void setup() {
  7.   pinMode(MOF_PIN, OUTPUT);
  8.   pinMode(POT_PIN, INPUT);
  9.   Serial.begin(9600);
  10. }
  11.  
  12. void loop() {
  13.   pot = analogRead(POT_PIN);
  14.   Serial.println(pot);
  15.  
  16.   analogWrite(MOF_PIN, pot/4);
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement