Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CurrentState=0;
- ISR(TIMER4_COMPA_vect)
- {
- digitalWrite(stepPin,HIGH);
- digitalWrite(stepPin,LOW);
- digitalWrite(stepPin2,HIGH);
- digitalWrite(stepPin2,LOW);
- }
- ISR(TIMER3_COMPA_vect)
- {
- digitalWrite(stepPin3,HIGH);
- digitalWrite(stepPin3,LOW);;
- }
- void setup()
- {
- cli();
- TCCR4A = 0;
- TCCR4B = 0;
- TCNT4 = 0;
- OCR4A = delayMinMotor2 ;
- TCCR4B |= (1 << WGM42);
- TCCR4B |= (1 << CS42);
- TCCR3A = 0;
- TCCR3B = 0;
- TCNT3 = 0;
- OCR3A = delayMinMotor;
- TCCR3B |= (1 << WGM32);
- TCCR3B |= (1 << CS32);
- sei();
- pinMode(stepPin, OUTPUT);
- pinMode(dirPin, OUTPUT);
- pinMode(stepPin2, OUTPUT);
- pinMode(dirPin2, OUTPUT);
- pinMode(stepPin3, OUTPUT);
- pinMode(dirPin3, OUTPUT);
- pinMode(RelayPin, OUTPUT);
- pinMode(RelayPin2, OUTPUT);
- digitalWrite(RelayPin, HIGH);
- digitalWrite(RelayPin2, HIGH);
- }
- void loop() {
- // put your main code here, to run repeatedly:
- switch(CurrentState):
- case 0 :
- {
- deplasare_lim1();
- }
- case 1 :
- {
- verificare_pir_2();
- }
- case 2 :
- {
- porneste_banda();
- CurrentState++;
- }
- case 3 :{
- verificare_pir_1();
- CurrentState++;
- }
- case 4 :{
- opreste_banda();
- CurrentState++;
- }
- case 5 :{
- deschide_cleste();
- coboara_brat();
- CurrentState++;
- }
- case 6 :{
- inchide_cleste();
- urca_brat();
- CurrentState++;
- }
- case 7 :
- {
- deplasare_lim2();
- CurrentState++;
- }
- case 8 :
- {
- verificare_senzor_nivel();
- CurrentState++;
- }
- case 9 :
- {
- coboara_brat();
- CurrentState++;
- }
- case 10 :
- {
- urca_brat();
- CurrentState++;
- }
- case 11 :
- {
- deplasare_lim3()
- CurrentState++;
- }
- case 12 :
- {
- coboara_brat();
- CurrentState++;
- }
- case 13 :
- {
- urca_brat();
- CurrentState++;
- }
- case 14 :
- {
- deplasare_lim4()
- CurrentState++;
- }
- case 15 :
- {
- coboara_brat();
- CurrentState++;
- }
- case 16 :
- {
- porneste_ventilatoare();
- delay();
- CurrentState++;
- }
- case 17 :
- {
- urca_brat();
- CurrentState++;
- }
- case 18 :
- {
- deplasare_lim6()
- CurrentState++;
- }
- case 19 :
- {
- coboara_brat();
- CurrentState++;
- }
- case 20 :
- {
- deschide_cleste();
- CurrentState++;
- }
- case 21 :
- {
- urca_brat();
- CurrentState++;
- }
- case 22 :
- {
- deplasare_lim1_2();
- CurrentState=0;
- }
- }
- void deplasare_lim1()
- {
- if(lim1 == 0)
- {
- digitalWrite(dirPin,LOW);
- digitalWrite(dirPin2,LOW);
- startTimer4();
- }
- else
- {
- stopTimer4();
- CurrentState++;
- }
- }
- void verificare_pir_2()
- {
- pir2 = digitalRead(PIR2);
- if(pir2 == 0
- }
- void porneste_banda()
- {
- digitalWrite(RelayPin, LOW);
- }
- void verificare_pir_1()
- {
- pir1 = digitalRead(PIR1);
- }
- void opreste_banda()
- {
- digitalWrite(RelayPin, HIGH);
- }
- void deschide_cleste()
- {
- }
- void coboara_brat()
- {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement