Advertisement
Guest User

Untitled

a guest
May 26th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.36 KB | None | 0 0
  1. int outMotor = 9;
  2. int readInput = A0;
  3. int output;
  4. int motorMapp;
  5. void setup()
  6. {
  7.   pinMode(outMotor, OUTPUT);
  8.   Serial.begin(9600);
  9. }
  10.  
  11. void loop()
  12. {
  13.  
  14.   output = analogRead(readInput);
  15.  
  16.   //Mapping
  17.   motorMapp = map(output, 0, 1023, 0, 255);
  18.   analogWrite(outMotor, motorMapp);
  19.   delay(1);
  20.  
  21.   Serial.println(motorMapp);
  22.   Serial.print(" ");
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement