Hi!
Ich habe an meinem RN-Control Board das SD21 Servoboard über den I2C Bus hängen.
Nun muss ich ja wenn ich mit Bascom programmiere immer die üblichen Befehle für die Vebrindung per I2C eingeben:
'=========================== Arm links ======================
Wenn ich nun meine 17 Servos damit ansteiere gibt das seitenweise Code!Code:Posit = 2320 ' position (1000 - 2000) Lsb = Low(posit) Msb = High(posit) I2cstart I2cwbyte Servo_adr ' serv CTRL I2C Addr I2cwbyte 0 ' servo nr I2cwbyte 10 ' speed I2cwbyte Lsb ' lsb of position I2cwbyte Msb ' Msb of position I2cstop Print "Servo 1 auf Position 2000" Posit = 2420 ' position (1000 - 2000) Lsb = Low(posit) Msb = High(posit) I2cstart I2cwbyte Servo_adr ' serv CTRL I2C Addr I2cwbyte 3 ' servo nr I2cwbyte 10 ' speed I2cwbyte Lsb ' lsb of position I2cwbyte Msb ' Msb of position I2cstop Print "Servo 2 auf Position 2000" 'Wait 1 Posit = 1540 ' position (1000 - 2000) Lsb = Low(posit) Msb = High(posit) I2cstart I2cwbyte Servo_adr ' serv CTRL I2C Addr I2cwbyte 6 ' servo nr I2cwbyte 10 ' speed I2cwbyte Lsb ' lsb of position I2cwbyte Msb ' Msb of position I2cstop Print "Servo 3 auf Position 2000" 'Wait 1
Gibt es eine Möglichkeit den Code zu vereinfachen?
Danke!
Gruß
Dennis







Zitieren

Lesezeichen