I have a school project that I am doing which is a sensing blind stick that will vibrate if there is an object in front of it. I have never used C++ and have only coded with python, so I don't have much of an idea of how this works. I am using an IR sensor, Arduino Nano microcontroller, and BestTong Mini vibrating pads. The code as of right now will only display a message about if there is an obstacle or not, and I found it online. How can I toggle the vibrating pad if it sees an object?
int isObstaclePin = A0; // This is our input pin
int isObstacle = HIGH; // HIGH MEANS NO OBSTACLE
void setup() {
pinMode(isObstaclePin, INPUT);
Serial.begin(9600);
}
void loop() {
isObstacle = digitalRead(isObstaclePin);
if (isObstacle == LOW){
Serial.println("OBSTACLE!!, OBSTACLE!!");
}
else{
Serial.println("clear");
}
delay(200);
}
Thanks!