Joystick-Arduino-RPi-Serial-Python

Good Morning everyone, i am Filippo,from Italy and i need your help. I have some troubles with the communication between Arduino and RPi.
I am using:
1)‘ThrustMaster flight joystick’ conncected to the RPi via USB.
2)Arduino Uno connected to the RPi via USB + 1 servo and LEDs on te Arduino.
3)I use Python 2.7.12 version

What i am trying to do is to read button states and axis values (with PYGAME library) from the joystick(using RPi) and then send infomations to the arduino whit SERIAL library to do something(now i am doing only some little tests…).
I am able to turn on and off LEDs,this is ok, but the problem is with the servo: i would like to control the servo position by moving the joystick axis(for example,Z axis).
Now: i am using the function ( pygame.JOYAXISMOTION ) to obtain the value of the axis (float, from -1 to 1), but now i do not now to pass
this value to the Arduino with the serial protocol.

Is possible to pass via serial integer/float values? If yes how can i do it?

Maybe you have a better solution to move the servo using the joystick…

Below i posted my python code that runs in the RPi: i found it in internet and i modified it a little bit. I can send strings via serial,ok,but,as i sad,the problem is with numbers (see below: e.dict[‘value’] ).

RaspiArduino.py.txt (4.86 KB)

Is possible to pass via serial integer/float values?

Yes.

If yes how can i do it?

On the Arduino, it would be Serial.print(someInt) or Serial.print(someFloat). I presume that there is something similar on the Pi.

I hope so....via Arduino i do not have problems....i have problems only via raspberry(python) because i do not know how to di it...in internet i've read that i have to convert numbers in bytes ant pass them via serial,but i do not know how to do it.