• Hi Gordon,the relevant commands are used for parameter setting. For the serial communication, the UART parameter need to be compatible for both espruino and module. The belowing code is for TX and RX between two LoRa modules RF1276 and espruino.


    // TX
    
    // Alternate sending 1 and 2 to make RX expruio blink
    
    const int buttonPin = 10;     // the number of the pushbutton pin
    
    int buttonState = 0;         // variable for reading the pushbutton status
    
    
    void setup() {                
     Serial.begin(9600);   // it depend on serial port of RF1276, we set the serial port baud rate 9600bps
    
    }
    
    void loop() {  
     buttonState = digitalRead(buttonPin);
    
     // check if the pushbutton is pressed.
     // if it is, the buttonState is HIGH:
     if (buttonState == HIGH) {     
       // turn LED on:    
       Serial.println("1"); 
     } 
     else {
       // turn LED off:
       Serial.println("2");
     }
     delay(100); 
    
    }
    
    _____________________
    
    // RX
    
    int led = 13;
    
    void setup() {                
     pinMode(led, OUTPUT);
     Serial.begin(9600);
    }
    
    
    void loop() {
    
     if (Serial.available()){
       char input = Serial.read();
       switch (input){
       case '1':
         digitalWrite(led, HIGH);  
         delay(100); 
         break;
       case '2':
         digitalWrite(led, LOW); 
         delay(100); 
         break;
       }
     }  
     else // blinks if there is no serial connection available 
     {
       digitalWrite(led, HIGH);
       delay(200);
       digitalWrite(led, LOW);
       delay(200);
     }
    }
    
About

Avatar for Jasonwu @Jasonwu started