THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 14/12/2011 at 08:23, xxxxxxxx wrote:
Hi,
I am trying to send a serial command from C4D; a very simple code for now as I'm trying to get things working.
import serial
import c4d
def main() :
ser = serial.Serial(2)
ser.baudrate = 9600
command1 = chr(0x84)+chr(0x17)+chr(0x40)+chr(0x3E)
ser.write(command1)
if __name__=='__main__':
main()
The pyserial module is installed, and loads successfully. Also, communication on port COM3 seems established when the device is on. However, executing this script from the script manager does nothing. Nothing is thrown in the console, and the device (a pololu mini maestro 24) doesn't get the command. It does seem to get something, as the mini LED onboard blinks when I execute the script, but that's it.
I understand this is a bit specialized, and most likely outside of the usual C4D python scope, but anyone has any idea of what I'm doing wrong? I know similar things have been achieved, sending serial commands through c4d's python module (Srek got it working with an arduino board), but I can't seem to get it working.
For info, the bytes I mean to send are: 0x84, 0x17, 0x40, 0x3E
Breakdown:
Command "SET_TARGET" (0x84)
To channel 23 (0x17)
Send target 8000 (pair of data bytes with most significant bits cleared);
Target low bits (0x40)
Target high bits (0x3E)
Any help or pointer is really appreciated,
Thanks!
-A