Hallo Zusammen,
ich bekomme bei folgendem Code die Fehler Meldung (exit status 1
'rotateCCW' was not declared in this scope)
Kann mir Jemand bitte helfen?
Danke
#include <LiquidCrystal.h> // includes the LiquidCrystal Library
LiquidCrystal lcd(1, 2, 4, 5, 6, 7); // Creates an LC object. Parameters: (rs, enable, d4, d5, d6, d7)
// defines pins numbers
#define stepPin 3
#define dirPin 10
#define stepPin2 13
#define dirPin2 12
#define outputA 8
#define outputB 9
#define Switch 11
#define End1 31
#define End11 33
#define End2 35
#define End22 37
int counter = 0;
long angle = 0;
int aState = 0;
int aLastState = 0;
void setup() {
if (digitalRead(Switch)==HIGH){
pinMode(stepPin,OUTPUT);
pinMode(dirPin,OUTPUT);
pinMode (outputA,INPUT);
pinMode (outputB,INPUT);
pinMode (Switch,INPUT);
aLastState = digitalRead(outputA);
lcd.begin(16,2);
}
else{
pinMode(stepPin2,OUTPUT);
pinMode(dirPin2,OUTPUT);
pinMode (outputA,INPUT);
pinMode (outputB,INPUT);
pinMode (Switch,INPUT);
aLastState = digitalRead(outputA);
lcd.begin(16,2);
}
}
void loop() {
if (digitalRead(Switch)==HIGH){
aState = digitalRead(outputA);
if (aState != aLastState){
if ( aState = digitalRead(outputA)){
counter ++;
angle ++;
rotateCW();
}
else {
counter--;
angle --;
rotateCCW();
}
if (counter >=200 ) {
counter =0;
}
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Position: ");
lcd.print(int(angle*(-1.8)/360));
lcd.print("deg");
lcd.setCursor(0,1);
lcd.print("Min=0");
lcd.setCursor(8,1);
lcd.print("Max=45");
}
aLastState = aState;
}
else{
aState = digitalRead(outputA);
if (aState != aLastState){
if (digitalRead(outputB) != aState) {
counter ++;
angle ++;
rotateCW();
}
else {
counter--;
angle --;
rotateCCW();
}
if (counter >=200 ) {
counter =0;
}
lcd.clear();
lcd.setCursor(1,1);
lcd.print("Oeffnung: ");
lcd.print(int(angle*(-1.8)));
lcd.print("mm");
}
aLastState = aState;
}}
void rotateCW() {
if (digitalRead(End1)==LOW){
digitalWrite(stepPin,LOW);
lcd.setCursor(0,0);
lcd.print("Position: ");
lcd.print(int angle == 0);
lcd.print("deg");
lcd.setCursor(0,1);
lcd.print("Min=0");
lcd.setCursor(8,1);
lcd.print("Max=45");
}
if (digitalRead(End11)==LOW){
digitalWrite(stepPin,LOW);
lcd.setCursor(0,0);
lcd.print("Position: ");
lcd.print(int(angle*(-1.8)/360))
lcd.print("deg");
lcd.setCursor(0,1);
lcd.print("Min=0");
lcd.setCursor(8,1);
lcd.print("Max=45");
}
else{
if (digitalRead(Switch)==HIGH){
digitalWrite(dirPin,LOW);
digitalWrite(stepPin,HIGH);
delayMicroseconds(1000);
digitalWrite(stepPin,LOW);
delayMicroseconds(1000); }
else{
digitalWrite(dirPin2,LOW);
digitalWrite(stepPin2,HIGH);
delayMicroseconds(0);
digitalWrite(stepPin2,LOW);
delayMicroseconds(0);
}}
void rotateCCW() {
if (digitalRead(End2)==LOW){
digitalWrite(stepPin2,LOW);
lcd.setCursor(0,0);
lcd.print("Oeffnung: ");
lcd.print(int angle == 0);
lcd.print("deg");
lcd.setCursor(0,1);
lcd.print("Min=0mm");
lcd.setCursor(8,1);
lcd.print("Max=5mm");
}
if (digitalRead(End22)==LOW){
digitalWrite(stepPin2,LOW);
lcd.setCursor(0,0);
lcd.print("Oeffnung: ");
lcd.print(int(angle*(-1.8)/360))
lcd.print("mm");
lcd.setCursor(0,1);
lcd.print("Min=0mm");
lcd.setCursor(8,1);
lcd.print("Max=5mm");
}
else{
if (digitalRead(Switch)==HIGH){
digitalWrite(dirPin,HIGH);
digitalWrite(stepPin,HIGH);
delayMicroseconds(1000);
digitalWrite(stepPin,LOW);
delayMicroseconds(1000);
}
else {
digitalWrite(dirPin2,HIGH);
digitalWrite(stepPin2,HIGH);
delayMicroseconds(1000);
digitalWrite(stepPin2,LOW);
delayMicroseconds(1000); }
}}