Hallo!
Ich hab das Servomodul SD21 und wollte Funktionstests machen. Dazu hab ich folgendes Programm in Bascom geschrieben:
Beim Servo 1 macht er das auch manchmal. Manchmal stellt er mir das Servo aber auf eine Fixposition (nicht die Mitte) und dort bleibt er dann. Beim Einschalten fährt er auf die Mittelstellung, und nach ca. einer sekunde dann entweder ganz nach rechts und will immer weiter drehen, oder auf irgendeine position, die er aber auch halten will.Code:$regfile = "m32def.dat" $crystal = 8000000 'Quarzfrequenz $baud = 9600 Config Scl = Portc.0 'Ports fuer IIC-Bus Config Sda = Portc.1 Const Servo_adr = &HC2 'I2C Adress Servo Controller Dim Tnr As Byte Dim Lsb As Byte Dim Msb As Byte Dim Posit As Word I2cinit Tnr = 1 ' number of servo (0-x) Do Posit = 2200 ' position (1000 - 2000) Lsb = Low(posit) Msb = High(posit) I2cstart I2cwbyte Servo_adr ' serv CTRL I2C Addr I2cwbyte Tnr ' servo nr I2cwbyte Lsb ' lsb of position I2cwbyte Msb ' Msb of position I2cstop Waitms 3000 Posit = 800 ' position (1000 - 2000) I2cstart I2cwbyte Servo_adr ' serv CTRL I2C Addr I2cwbyte Tnr ' servo nr I2cwbyte Lsb ' lsb of position I2cwbyte Msb ' Msb of position I2cstop Waitms 3000 Loop End
Verstehe das einer...
Wenn ich in dem Programm allerdings das Servo auf Nr. 2 oder 3 oder.... usw. ändere passiert garnix.
Wer weiß rat?
mfg, Dave







Zitieren


Lesezeichen