Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///////////// transmitter v2.0 /////////
- #include <SPI.h>
- #include <RH_ASK.h> //rf library
- const byte adressPin1 = 7;
- const byte adressPin2 = 8;
- int adress1, adress2;
- //RH_ASK rf_driver(2000,10); //syntax for changing digital pin and baud rate
- RH_ASK rf_driver; //default tx pin D12
- //uint8_t buff[11]; //array for storing message for
- char *message1 = "Activation";
- char *message2 = "Moonwalker";
- char message3 = "Enterprise";
- char message4 = "Resolution";
- char *msg; //rf message
- void setup() {
- Serial.begin(9600);
- rf_driver.init();
- pinMode(LED_BUILTIN, OUTPUT);
- pinMode(adressPin1, INPUT);
- pinMode(adressPin2, INPUT);
- adress1 = digitalRead(adressPin1);
- adress2 = digitalRead(adressPin2);
- ////testing///
- adress1 = LOW;
- adress2 = LOW;
- //////////////
- if(adress1 == LOW && adress2 == LOW)
- *msg = *message1;
- if(adress1 == LOW && adress2 == HIGH)
- msg = *message2;
- //if(adress1 == HIGH && adress2 == LOW)
- //msg = message3;
- //if(adress1 == HIGH && adress2 == HIGH)
- //msg = message4;
- }
- void loop() {
- digitalWrite(LED_BUILTIN, HIGH);
- rf_driver.send((uint8_t*)msg, strlen(msg));
- rf_driver.waitPacketSent();
- digitalWrite(LED_BUILTIN, LOW);
- delay(500);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement