Skip to content
Snippets Groups Projects
Commit 424e7f2b authored by 13035516's avatar 13035516
Browse files

vibration motor func to be tested

parent 31a248c5
No related merge requests found
......@@ -16,7 +16,8 @@
/* Serial Options */
#define BAUDRATE 115200
#define PING '1'
#define MOTORPING '2'
#define MOTORPING_ON '2'
#define MOTORPING_OFF '3'
/* =================================== */
/* Pin layout */
......
......@@ -36,10 +36,11 @@ void SerialCommunication::Read_Update_Request() {
update_request = false;
}
if (serial_in == MOTORPING) {
if (serial_in == MOTORPING_ON) {
motor_flag = true;
} else if (serial_in != MOTORPING) {
} else if (serial_in == MOTORPING_OFF) {
motor_flag = false;
}
}
}
......
......@@ -55,12 +55,18 @@ void loop() {
if(DSwitch[1].Get_Val()) {
digitalWrite(NSLEEP_PIN, HIGH);
} else {
digitalwrite(NSLEEP_PIN, LOW);
digitalWrite(NSLEEP_PIN, LOW);
}
if (motor_flag) {
VibeMotor.Drive_Motor();
vibration_output = VibeMotor.Get_Amplitude();
Serial.println("driving motor");
} else {
VibeMotor.Set_Amplitude(0);
VibeMotor.Drive_Motor();
vibration_output = VibeMotor.Get_Amplitude();
Serial.println("stopping motor");
}
for (int j = 0 ; j < 3; j++) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment