#include <RH_ASK.h>
#include <SPI.h> // Not actually used but needed to compile
RH_ASK driver;
const int openClose = 2; // the number of the pushbutton pin
const int up = 3;
const int down = 4;
const int stackShip = 5;
const int launch = 6;
const int sideToSide = 7;
void setup()
{
Serial.begin(9600); // Debugging only
if (!driver.init())
Serial.println("init failed");
// initialize the pushbutton pin as an input:
pinMode(openClose, INPUT);
pinMode(up, INPUT);
pinMode(down, INPUT);
pinMode(stackShip, INPUT);
pinMode(launch, INPUT);
pinMode(sideToSide, INPUT);
}
void loop()
{
// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (digitalRead(openClose) == HIGH) {
const char *msg = "Open/Close";
driver.send((uint8_t *)msg, strlen(msg));
driver.waitPacketSent();
}
if (digitalRead(up) == HIGH) {
const char *msg = "up";
driver.send((uint8_t *)msg, strlen(msg));
driver.waitPacketSent();
}
if (digitalRead(down) == HIGH) {
const char *msg = "down";
driver.send((uint8_t *)msg, strlen(msg));
driver.waitPacketSent();
}
if (digitalRead(stackShip) == HIGH) {
const char *msg = "stackShip";
driver.send((uint8_t *)msg, strlen(msg));
driver.waitPacketSent();
}
if (digitalRead(launch) == HIGH) {
const char *msg = "launch";
driver.send((uint8_t *)msg, strlen(msg));
driver.waitPacketSent();
}
if (digitalRead(sideToSide) == HIGH) {
const char *msg = "sideToSide";
driver.send((uint8_t *)msg, strlen(msg));
driver.waitPacketSent();
}
}