value from python to be used in arduino ide

I need a python code to interface LORA module but still using an arduino board.
import serial. Iam using the following python code to access the serial monitor of the arduino.

value from python=>arduino(read the value)=>LoRa sender(send value)=>LoRa receiver(receive value)

for suppose I have a value 7 which I want to send through LoRa sender(which I have connected to an arduino UNO )and receive the same at receiver.

I’m able to read and write the data in serial monitor using these commands but I also want to send through LoRa

this is the python code

ser = serial.Serial(‘COM8’, baudrate = 9600, timeout=1)
data=7
while 1:
arduinoData = ser.readline()
ser.write(data)
print(data)

this is the arduino LoRa code where I want to send the actual value instead of "hello (counter) "
#include <SPI.h>
#include <LoRa.h>

int counter = 0;

void setup() {
Serial.begin(9600);
while (!Serial);

Serial.println(“LoRa Sender”);

if (!LoRa.begin(433E6)) {
Serial.println(“Starting LoRa failed!”);
while (1);
}
}

void loop() {
Serial.print("Sending packet: ");
Serial.println(counter);

// send packet
LoRa.beginPacket();
LoRa.print("hello ");
LoRa.print(counter);
LoRa.endPacket();

counter++;

delay(5000);
}

abhiramnvs:
value from python=>arduino(read the value)=>LoRa sender(send value)=>LoRa receiver(receive value)

for suppose I have a value 7 which I want to send through LoRa sender(which I have connected to an arduino UNO )and receive the same at receiver.

I'm able to read and write the data in serial monitor using these commands but I also want to send through LoRa

Sorry, I can't make sense of all that. I don't know if it refers to three different physical setups or if everything refers to the same setup at the same time. It is not even clear how many Arduinos are involved.

Maybe you can make a simple pencil drawing showing what is connected to what and with arrows to show the flow of data. See this Simple Image Posting Guide

You can only connect one PC program to an Arduino at any one time. If the Serial Monitor is connected then your Python program cannot be.

...R
Simple Python - Arduino demo

Google Photos

I have 2 arduinos and 2 LoRa modules. I'm using 1ard+1lora as sender and the other ard+lora as receiver.
But the message which I want to send is from python through arduino which is

value from python->ard+Lora sender(send value)->ard+Lora(receive value).

So right now I have the Lora sender and receiver programs but I am unable to send the message from the python code.

I have a value 7 in python which should be sent through arduino+Lora module.
Let me know if the question should be still more clear..

It's much easier to help if you make your images visible in your Post rather than on another website. I gave you a link to the instructions.

So it seems you want to send data from Python over the USB cable to Arduino A and then Arduino A sends the data to Arduino B using LoRa.

Where in this chain of events are you identifying the problem?

Have you studied my Python demo?

,..R

I'm not able to send the values to arduino A and then as a message through LoRa. how do I read values from python in arduino and send it through LoRa?

Why dont first sorting out how to ge the value from Python on your PC to the Arduino, as has been suggested already ?

Once that is working, then tackle sending the data from one Arduino to another.

It was suggested the last time you raised this problem, that it would be possible, with the appropriate LoRa device to send the data direct from the PC.

If you want a complete end to end solution, then perhaps go over to ‘Gigs and Collaborations’ and ask in there, indicating how much you prepared to pay.

abhiramnvs:
I'm not able to send the values to arduino A and then as a message through LoRa.

Does that mean that you are only checking on Arduino B to see if the message has arrived?

If so then you have no idea whether this is a problem with Python, or with the code in Arduino A, or with the wireless connection or with the interface between either Arduino and its wireless module or with the code in Arduino B.

You need to focus you testing much more closely on each link of the chain one at a time.

And, you have not said if you have carefully studied my Python demo.

...R