PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Joypad/ RN-Control/ 2 Getriebemotoren



hssbiker
24.04.2011, 02:46
Hallo, Jungs!
Ich habe mir RN-Control, RN-Joypad und RN-VN2 Dualmotor angeschaft und möchte 2 Getriebemotoren mit einem Joystick steuern, X-Achse Motor1, Y-Achse Motor2. Da ich in dem Bereich neu bin, kann ich das (mit BASCOM) nicht programmieren. Ob mir jemand helfen kann?:(

TobiKa
24.04.2011, 10:03
Dann solltest du dir erstmal die nötigen Grundlagen aneignen und danach versuchen die Beispiele zu den einzelnen Modulen (sind auf der CD die mitgeschickt wird) zu verstehen.

hssbiker
24.04.2011, 12:30
Verstehen ist gut, aber ich stehe unter Zeitdruck. Wenn ich irgend ein funktionierendes Programm hätte wo ich mit dem Joystick irgend was steuern kann, um zu sehen wie das ganze funktioniert.

TobiKa
24.04.2011, 12:38
Ach ok.
Aber wie gesagt, auf der CD sind einige Beispiele, die du nur zusammenbasteln musst.

hssbiker
24.04.2011, 13:43
Wenn ich wüsste wie. Hab schon mehrere Nächte dran gesessen, klappt aber nichts.

TobiKa
24.04.2011, 17:14
Dann zeig her was du bis jetzt hast, dann wird dir sicher geholfen werden!

hssbiker
26.04.2011, 01:36
Es ist mir peinlich, aber ich habe echt keine Ahnung

Declare Sub Motor1()
Declare Sub Motor2()
Declare Sub Motor3()
Declare Sub Motor4()
Declare Function Joystickabfrage() As Byte


$regfile = "m32def.dat"
$framesize = 32
$swstack = 32
$hwstack = 32


Dim I As Integer
Dim N As Integer
Dim Ton As Integer

$crystal = 16000000 'Quarzfrequenz
$baud = 9600

Config Porta = Input
Config Adc = Single , Prescaler = Auto 'Für Tastenabfrage und Spannungsmessung

Dim Joy1x As Word 'Variablen für Positionen der JoyPad Steuerknüppel
Dim Joy1y As Word

Start Adc

'Ports für linken Motor
Config Pinc.6 = Output 'Linker Motor Kanal 1
Config Pinc.7 = Output 'Linker Motor Kanal 2
Config Pind.4 = Output 'Linker Motor PWM
'Ports für rechten Motor
Config Pinb.0 = Output 'Rechter Motor Kanal 1
Config Pinb.1 = Output 'Rechter Motor Kanal 2
Config Pind.5 = Output 'Rechter Motor PWM
Config Timer1 = Pwm , Pwm = 10 , Compare A Pwm = Clear Down , Compare B Pwm = Clear Down
Pwm1a = 0
Pwm1b = 0
Tccr1b = Tccr1b Or &H02 'Prescaler = 8
I = 0
Sound Portd.7 , 400 , 450 'BEEP
Sound Portd.7 , 400 , 250 'BEEP
Sound Portd.7 , 400 , 450 'BEEP
Print
Print "**** RN-CONTROL 1.4 *****"
Print "Das neue Experimentier- und Roboterboard"
Print "Weitere passende Zusatzboards bei www.robotikhardware.de"
Print

Function Joystickabfrage() As Byte
Do

Joy1y = Getadc(0)
Joy1x = Getadc(1)
Print "Joystick 1 Position: X=" ; Joy1x ; " Y=" ; Joy1y
Wait 2
Loop




End Function





'Motoren und Geschwindigkeitsreglung
Sub Motor1()

'Rechter Motor ein
Portb.0 = 1 'bestimmt Richtung rechter Motor
Portb.1 = 0 'bestimmt Richtung rechter Motor
Portd.5 = 1 'rechter Motor EIN


I = 0
Do
Pwm1a = 0
Pwm1b = I
Waitms 5
I = I + 10
Loop Until I > 300

Wait 1
Do
Pwm1a = 0
Pwm1b = I
Waitms 5
I = I - 10
Loop Until I < 1
Pwm1a = 0 'Linker Motor aus
Pwm1b = 0 'rechter Motor aus
End Sub


'Motoren und Geschwindigkeitsreglung
Sub Motor2()
'Rechter Motor ein
Portc.0 = 0 'bestimmt Richtung
Portc.1 = 1 'bestimmt Richtung
Portd.5 = 1 'rechter Motor EIN

I = 0
Do
Pwm1a = 0
Pwm1b = I
Waitms 5
I = I + 10
Loop Until I > 300

Wait 1
Do
Pwm1a = 0
Pwm1b = I
Waitms 5
I = I - 10
Loop Until I < 1
Pwm1a = 0 'Linker Motor aus
Pwm1b = 0 'rechter Motor aus
End Sub

'Motoren und Geschwindigkeitsreglung
Sub Motor3()
'Linker Motor ein
Portb.6 = 0 'bestimmt Richtung rechter Motor
Portb.7 = 1 'bestimmt Richtung rechter Motor
Portd.4 = 1 'linker Motor EIN


I = 0
Do
Pwm1a = I
Pwm1b = 0
Waitms 5
I = I + 10
Loop Until I > 300

Wait 1
Do
Pwm1a = I
Pwm1b = 0
Waitms 5
I = I - 10
Loop Until I < 1
Pwm1a = 0 'Linker Motor aus
Pwm1b = 0 'rechter Motor aus
End Sub


'Motoren und Geschwindigkeitsreglung
Sub Motor4()
'Linker Motor ein
Portc.6 = 1 'bestimmt Richtung
Portc.7 = 0 'bestimmt Richtung
Portd.4 = 1 'Linker Motor EIN


I = 0
Do
Pwm1a = I
Pwm1b = 0
Waitms 5
I = I + 10
Loop Until I > 300

Wait 1
Do
Pwm1a = I
Pwm1b = 0
Waitms 5
I = I - 10
Loop Until I < 1
Pwm1a = 0 'Linker Motor aus
Pwm1b = 0 'rechter Motor aus
End Sub

hssbiker
26.04.2011, 21:54
Kann mir keiner helfen?:(:(:(

hssbiker
27.04.2011, 23:57
Hallo, Profis! Ein Anfänger braucht Hilfe.](*,)