Alright playing around with the controller code for a while and this is what I have:
#include <VirtualWire.h>
int RF_TX_PIN = 2;
int Button1 = 13; //Forward (Button 1)
int Button2 = 12; //Backwards (Button 2)
void setup()
{
Serial.begin(9600);
Serial.println("Setup Complete");
vw_set_tx_pin(RF_TX_PIN); // Setup transmit pin
vw_setup(2000); // Transmission speed in bits per second.
pinMode(Button1, INPUT);
pinMode(Button2, INPUT);
}
void loop()
{
if (digitalRead(Button1)){
Serial.println("Forwards");
const char *msg = "1";
vw_send((uint8_t *)msg, strlen(msg)); // Send 'Forwards' every 50ms.
}
else if (digitalRead(Button2)){
Serial.println("Backwards");
const char *msg = "2";
vw_send((uint8_t *)msg, strlen(msg)); // Send 'Backwards' every 50ms.
}
else {
Serial.println("Stop");
const char *msg = "0";
vw_send((uint8_t *)msg, strlen(msg)); // Send 'Stop' every 50ms.
}
}
Everything works, other then the fact that it is always transmitting "2" or backwards. As of right now I am stuck because I even did some research on how if-then-else statements and how they work and I don't see why this doesn't work.