hi everybody, finally i could communicate the arduino with the blender game engine.
i get the information from here:
i’m controlling a cube with 2 potentiometers (2 externals signs) one is for the direccion and the other one is for the speed, as you can see this ambient, cube(blue) , floor (green), ramp(gray)
Serial.print(analogRead(0)/4, BYTE); //direction
Serial.print(analogRead(1)/4, BYTE); // speed
this is the python script which receives the 2 inputs from the serial port and write them on the text file.
serialport = serial.Serial(‘COM3’, 9600)
x = serialport.read(size=1)
y = serialport.read(size=1)
this is the python script of the blender game engine which controls the direction and the speed of a cube.
contr = GameLogic.getCurrentController()
z = 0.001*(ord(x)-128)
location.dRot=[0,0,z] // direction
w = 0.001*(ord(y))
location.dLoc=[w,0,0] // speed
i need to send a character to the serial port when the cube is climbing the ramp
i already have the code that identifies when the cube is going up with a variable, the variable is “a” and when the cube is going up a==1 and a==0 when not.