Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Jung Min Yean
- * Learning How to Use a Continuous Motor
- * 04/23/2019
- */
- const int motorPin = 9;
- const int PotPin = A0;
- int PotVal = 0;
- void setup()
- {
- pinMode(motorPin, OUTPUT);
- pinMode(PotPin, INPUT);
- Serial.begin(9600);
- }
- void loop()
- {
- PotVal = analogRead(PotPin);
- int MapVal = map(PotVal,0,1023,0,255);
- analogWrite(motorPin, PotVal);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement