I'm building a 6dof simulator for racing games on the computer. I have 6 motors with one Arduino mega and a relay card connected to each motor. The code does convert the signal from the computer to a 0-1024 scale, and then i have a potentiomoter on the motor for feedback. I then scale the potmeter to the same 0-1024. The code then compares the two values, and runs the motor back/forward to always make the two values the same. This works, but when i connect the arduino with usb, and start sending signal it freezes. does not react on the potentiometer feedback, and sets all the relay outputs high. In the Serial Monitor i can type som hex-codes to run the motor to a new setpoint, and that works. I cant upload my code sence im a new user. Any suggestions ?
How have you been testing the project without connecting it to the computer?
Looking at your schematic.....
(That's a hint, son).
This sounds like a power issue.
Thanks for reply! I can write some hexadecimal codes in the Serial Monitor, to simulate different values from the Game.
In the "Serial Monitor" send the following strings in Hexa and Enter:
> it should move the playseat in horizontal position"
When the signal comes from the software that send values from a game, the arduino freezes. I have 6 arduinos, and they all react the same.
Ive tried both with usb directly from the PC, and with a powered usb hub. could try to connect seperate power on the arduino tho.. Will try! Thanks
Do you have the serial monitor set to NOT send cr/lf at the end of each code you enter?
It was on "newline". I works with both newline and NOT send cr/lf.
I can upload the code now. And the data from the game is; hex, 8 bits, No parity, Stop bits 1, bit range 8 and 115200 baud. 1DOF-6interface_working.ino (10.1 . KB)
If you post your code as described in How to get the best out of this forum, more forum members will read it.