Communication between arduino and python and NRF24L01

I want to send two numbers (100 and 100) from python to an arduino UNO card and from this arduino Uno card i want to send these numbers to another arduino nano card by NRF24L01 to control a mobile robot (two wheels).
When I tried to send two commands (100 and 100) from arduino UNO to arduino Nano (the mobile robot) the robot works, but when I use python the robot does not work.I could not find the problem ,help me please,
if it’s possible, I want to know how the function write of pyserial (arduino.write)it works,

Python code :

import serial
V="<100,100>";
arduino = serial.Serial('COM7',9600)
while (True):
        arduino.write(V)

Arduino UNO code (transmitter)

#include <SPI.h>
#include "RF24.h"
#define Size 7

char InfoTab[Size]; 
byte Index=0;

char StartChar='<';
char EndChar='>';
// NRF24L01
RF24 radio(7,8);

const uint64_t pipe=0xABCDABCD71LL;

char TempTab[Size];  

int Vd;
int Vg;

int command[2];

boolean Storage=false;

//============

void setup() {
    Serial.begin(9600);
    radio.begin();
    radio.openWritingPipe(pipe);
    radio.stopListening(); 
}

//============

void loop() {
     GetChainString();
     if (GetChainString()){
      strcpy(TempTab,InfoTab);
      DataAnalysis();
      command[0]=Vd;
      command[1]=Vd;
      radio.write(&command,sizeof(command));
     }
}

//============

boolean GetChainString() {
        byte static Index=0;
        while (Serial.available()>0) {
               for (int k=0;k<5;k++){
               char IncomingByte=Serial.read();
               if (Storage){
               if (Index==Size) { 
                   Index=0;
                   break;
                   }
                else if (IncomingByte==EndChar) { 
                         Storage=false;                
                         return true; 
                          }
                     else{
                         InfoTab[Index]=IncomingByte;
                         Index=Index+1;
                         }
                 }
               if (IncomingByte==StartChar) {
                   Index=0; 
                   Storage=true; 
                   }  
         }
        }
return false;
}

//============

void DataAnalysis(){      
    char * strtokIndx; 
    strtokIndx=strtok(TempTab,","); 
    Vd=atoi(TempTab);     
    strtokIndx=strtok(NULL,","); 
    Vg=atoi(strtokIndx);   
}

Arduino Nano code (receiver)

#include <SPI.h>
#include "RF24.h"

RF24 radio(7,8);
const uint64_t pipe = 0xABCDABCD71LL;

int command[2];
// motor 1
int in1 = 9;
int in2 = 6;
// motor 2
int in3 = 5;
int in4 = 3;
void setup() {
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
  pinMode(in3, OUTPUT);
  pinMode(in4, OUTPUT);
  Serial.begin (9600);
  radio.begin();
  radio.openReadingPipe (1, pipe);
  radio.startListening();
}

void loop() {
  
while (radio.available()>0)
  {
    radio.read(&command,sizeof(command));
    
    // motor 1
    analogWrite(in1,command[0]);
    analogWrite(in2, 0);
    // motor 2
    analogWrite(in3,command[1]);
    analogWrite(in4, 0);
  }  

}

Your Python program is trying to send data a million times a second. Slow it down so it just sends the data say 5 or 10 times per second.

Also, when you Python program opens the serial port it will cause the Arduino to reset. It must allow time for that before it starts sending data. Have a look at this Python - Arduino demo

Have a look at the examples in Serial Input Basics - simple reliable ways to receive data.

Simple nRF24L01+ Tutorial

...R

I saw your topics, and it helped me a lot. I think the problem is in python code (i did as you say but there is no answer)

ghostin: I think the problem is in python code (i did as you say but there is no answer)

Unless you post your latest code I can't see exactly what you did. The devil is in the detail.

Have you tried my Python example?

...R