Hi!

Hier noch mein Programmcode:

Code:
$regfile = "m32def.dat"                                     'Die Anweisung bestimmt Ccntrollertyp, hier AVR Mega 32
$crystal = 16000000

$baud = 9600

' I2C SETUP
Config Scl = Portc.0
Config Sda = Portc.1
Config Twi = 100000

'LED AUS
Config Portc.2 = Output
Config Portc.3 = Output

Portc.2 = 0
Portc.3 = 0

' CONSTANTS                                                   'Anx-S20 Board Slave Adresse
Const Anx = &HC2

' FUNCTIONS
Declare Sub Anxwrite(byval Servo As Byte , Byval Pos As Byte)

Call Anxwrite(4 , 80)
Wait 2
Call Anxwrite(4 , 180)
Wait 2


Print "Kopf rechts - links.."


I2cinit
'Startet den I2C Bus

Sub Anxwrite(servo As Byte , Pos As Byte)
   I2cstart
   I2cwbyte Anx
   Servo = Servo + 62
   I2cwbyte Servo                                           ' 8-Bit Register ab Reg. 63
   I2cwbyte Pos
   I2cstop
   Waitms 10
End Sub