I am new to arduino and lora technology and i have dragino lorashield for arduino Uno and dragino gateway. I have also MQ-3 gas sensor and I want to detect the alcohol value and to send it to the gateway using the lorashield after that the gateway should send the data to ThingSpeak platform. Currently the code for my MQ-3 sensor is as below. I would like to ask you for some help as I dont know how to write the code for the dragino and to send it to the gateway. Thanks in advance!

void setup() { Serial.begin(9600); } void loop() { float sensor_volt; float RS_gas; // Get value of RS in a GAS float ratio; // Get ratio RS_GAS/RS_air int sensorValue = analogRead(A0); sensor_volt=(float)sensorValue/1024*5.0; RS_gas = (5.0-sensor_volt)/sensor_volt; // omit *RL /*-Replace the name "R0" with the value of R0 in the demo of First Test -*/ ratio = RS_gas/0.01; // ratio = RS/R0 /*------------------------------------------------------------------- ----*/ Serial.print("sensor_volt = "); Serial.println(sensor_volt); Serial.print("RS_ratio = "); Serial.println(RS_gas); Serial.print("Rs/R0 = "); Serial.println(ratio); Serial.print("\n\n"); delay(1000); } The code is working fine when I am using only the arduino. How do I modify it to use lora and to send the data to the gateway?

  • 1
    start with any example sketches that you can find
    – jsotola
    Dec 29 '19 at 23:52
  • please format your code ... put ``` (three backticks) on a blank line before the code and same after the code
    – jsotola
    Dec 29 '19 at 23:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.