Created
January 8, 2020 02:37
-
-
Save deviceplususer/b3213c77cdde0e5cf45ca93d0bfcb0ee 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