Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ask_transmit
- //DATA NANO D12
- #include <RH_ASK.h>
- #include <SPI.h> // Not actually used but needed to compile
- RH_ASK driver;//Instancia Driver RH_ASK
- uint8_t cnt=0;
- String mensaje="TX";
- void Debug(char* txt){
- if (Serial){
- Serial.println (txt);
- }
- }
- void setup()
- {
- if (Serial)
- {Serial.begin(9600);} // Debug RS232
- else {while (true){};}
- if (!driver.init()){
- Debug("TX problem !!!");
- }else { Debug ("TX inicializado ");}
- }
- void loop()
- {
- const char *msg = mensaje.c_str() ;//Mensaje de base
- String num=String (cnt+'\0');
- const char *msg2=num.c_str()+'\0';//Contador
- //strcat(msg,msg2);
- driver.send((uint8_t *)msg, strlen(msg)+1);
- driver.waitPacketSent();
- delay(1000);
- driver.send((uint8_t *)msg2, strlen(msg2)+1);
- driver.waitPacketSent();
- cnt+=1;
- Debug (msg);
- delay(2000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement