Using Bluetooth RC car app in effort to control Uno rev4 wifi w/8channel relay module to control 12 vdc ebike motor powered yard wagon with on board 12v battery and relays for isolation . My Android phone pairs with HC-05 module OK but no serial activity when pushing any of the control buttons on phone . I have already run this setup using an Uno rev 3 with an Adafruit motor shield controlling 4 relays but I would like to use 8 relays instead to utilize all 8 of the RC car app buttons . Here is my code below . It compiles OK but says it can't locate IRremote.h header files ? My other setup with the Uno rev3 /motor shield used the <AFMotor.h> and communicated just fine
Not sure about the RingBuffer.h this pops up everytime I have included SoftwareSerial.h leading me to believe maybe it also has to be included.
#include <RingBuffer.h>
#include <SoftwareSerial.h>
SoftwareSerial bluetooth(3,2);
char t;
#define relay1 13
#define relay2 12
#define relay3 11
#define relay4 10
#define relay5 9
#define relay6 8
#define relay7 7
#define relay8 6
void setup()
{
Serial.begin(9600);
bluetooth.begin(9600);
pinMode(relay1,OUTPUT); //motor forward
pinMode(relay2,OUTPUT); //motor reverse
pinMode(relay3,OUTPUT); //steer left
pinMode(relay4,OUTPUT); //steer right
pinMode(relay5,OUTPUT); //headlight button = controller slow speed
pinMode(relay6,OUTPUT); //taillight button = controller medium speed
pinMode(relay7,OUTPUT); //horn button = controller fast speed
pinMode(relay8,OUTPUT); // spare?
}
void loop() {
if(bluetooth.available()>0)
{
t = bluetooth.read();
Serial.println(t);
}
if(t == 'F'){ //move forward(motor rotates in forward direction) relay module require reverse logic to assert relay
digitalWrite(relay1,LOW);
}
if (t == 'B'){digitalWrite(relay2,LOW); //move reverse direction (motor rotates in reverse direction )
}
if(t == 'L'){ //turn left -actuator steers left
digitalWrite(relay3,LOW);
}
if(t == 'R'){ // turn right - actuator steers right
digitalWrite(relay4,LOW);
}
if(t == 'W'){ //headlights "ON " (motor controller to second speed step)
digitalWrite(relay5,LOW);
}
else if(t == 'w'){ // headlights "OFF" (motor controller back to crawl speed )
digitalWrite(relay5,HIGH);
}
if(t == 'U'){ //backlights "ON" ( motor controller to 3rd speed step)
digitalWrite(relay6,LOW);
}
else if(t == 'u'){ //backlights "OFF" (motor controller back to 2nd speed step )
digitalWrite(relay6,HIGH);
}
if (t == 'V'){ // horn "ON" (motor controller on 4th speed step)
digitalWrite(relay7,LOW);
}
else if(t == 'v'){ // horn "OFF" (motor controller back to 3rd speed step )
digitalWrite(relay7,HIGH);
}
if(t == 'X'){ //turn hazard on or off) spare contact
digitalWrite(relay8,LOW);
}
else if(t == 'x'){
digitalWrite(relay8,HIGH);
}
else if(t == 'S'){ //STOP (all momentary outputs stop)reverse logic due to relay module (-) to operate
digitalWrite(relay1,HIGH);
digitalWrite(relay2,HIGH);
digitalWrite(relay3,HIGH);
digitalWrite(relay4,HIGH);
}
delay(100);
}