INFO - FAQ - CC2-Forum - CCPro-Forum |
|
Hallo, meine Solarsteuerung wird mit einem Linearantrieb verstellt. Die Steuerung wird mit der Micro über eine H-Brücke (L298N) betätigt. In der Morgenstellung sollte ein Endschalter (Port2) betätigt werden (siehe Programm). Der Eingang wird zwar geschalten, aber der Linearmotor fährt über den Endschalter weiter(Reed). Was ist hier falsch im Programm. ' ********************************** 'BASIC++ Micro Programm: 20.Nov.2006 ' Solarsteuerung, nach der Sonne ausrichten '-------------------------------------- ' an Port-1=Sensor Photo und 10K Wiederstand ' an Port 2=Endschalter Morgenstellung ' an Port-4=Motor ' an Port-6=Motor ' an GND=Sensor und Masse ' an +5V=10K Widerstand ' ACHTUNG, bei offenen Ports 10K PullUp Widerstand setzen ' ********************************** OPTION CCMICRO 'Zielplattform define licht ad[1] 'Sensor Licht (A9060) define stopp port[2] 'Endschalter Morgenstellung????? define l byte 'Zähler Licht- Schaltschwelle define x byte 'Zähler Zeit define Motor_1 port[4] 'Motor define Motor_2 port[5] 'Motor CONSt hell = 100 'Schaltschwelle Hell(100) (weniger = heller) Function zustell() for x=1 to 10 '= warten 20 min pause 50 next Motor_1 = off ' Motor Rechtslauf, Zustellung Motor_2 = on Pause 170 Motor_1 = off ' Motor aus Motor_2 = off pause 50 End Function Function zurueck() stopp= on Motor_1 = on ' Motor Linkslauf, in Morgenstellung Motor_2 = off if stopp= off then goto morgen 'prüfe Endschalter Morgenstellung (funktioniert nicht) for x=1 to 12 ' Motor Laufzeit pause 170 next Motor_1 = off ' Motor aus Motor_2 = off End Function 'PROGRAMM-START l = licht pause 250 zurück() wait licht > hell 'warte bis Dunkelheit #morgen if licht <= hell then pause 250 'bei hell warte 5 Sekunden if licht <= hell then 'wenn hell dann Programmstart zustell() zustell() zustell() zustell() zustell() zustell() zustell() zustell() wait licht > hell 'warte bis Dunkelheit zurueck() 'Panel fährt in Morgenstellung end if goto morgen |
Antwort schreiben |