i am trying to control a brushless motor with bluetooth using 1 button as start and stop (if i let go ot stops), i have HC-05 one as a slave and a master.
i did one without wireless it was great, not sure how the wireless one works.
Arduino Nano boards and a mini button with 10k resistor.
Master
#include <SoftwareSerial.h>
#define BT_SERIAL_TX 4
#define BT_SERIAL_RX 3
SoftwareSerial BluetoothSerial(BT_SERIAL_TX, BT_SERIAL_RX);
int pushButton = 5;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
BluetoothSerial.begin(9600);
pinMode(pushButton, INPUT);
}
void loop() {https://forum.arduino.cc/
// put your main code here, to run repeatedly:
{
if (digitalRead(pushButton) == HIGH > LOW) { //Opens the door when the 'open' button is pressed
digitalWrite(90, HIGH);
delay(1);
} else {
digitalWrite(40, LOW);
BluetoothSerial.write(digitalRead);
delay(1);
}
}}
Slave
#include <SoftwareSerial.h>
#define BT_SERIAL_TX 4
#define BT_SERIAL_RX 3
SoftwareSerial BluetoothSerial(BT_SERIAL_TX, BT_SERIAL_RX);
# include <Servo.h>
Servo m1;
unsigned int val ;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
BluetoothSerial.begin(9600);
delay(1);
m1.attach(10);
delay(1);
m1.write(40);
}
void loop() {https://forum.arduino.cc/
// put your main code here, to run repeatedly:
if (BluetoothSerial.available()>0){
val = BluetoothSerial.read();
m1.write(val);
} else {
m1.write(0);
delay(1);
}
}