Created
January 14, 2020 06:53
-
-
Save deviceplususer/87d62a1661eedad24b6a48333e12bc43 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SparkFun_TB6612.h> | |
#define AIN1 2 | |
#define AIN2 4 | |
#define PWMA 5 | |
#define STBY 9 | |
const int offsetA = 1; | |
Motor motor1 = Motor(AIN1, AIN2, PWMA, offsetA, STBY); | |
void setup() | |
{ | |
Serial.begin(9600); | |
} | |
void loop() | |
{ | |
int volume = analogRead(A0); | |
volume = map( volume, 0, 1023, 30, 255 ); | |
motor1.drive( volume ); | |
Serial.println( volume ); | |
delay(10); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment