Zkušebna a studio pro Ostravu!!! Domov zesilovačů Friedman!!!

Studio Jakubka Ostrava

const int buttonPin = 2; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin
const int Relay1 = 11; // relay 1 on pin 11
const int Relay2 = 12; // relay 2 on pin 12
const int Led1 = 9; // LED relay 1
const int Led2 = 10; // LED Relay 2


int ledState = HIGH; // the current state of the output pin
int relayState = HIGH;
int switchstate = LOW;
int lastswitchstate = LOW;



void setup() {
// put your setup code here, to run once:
pinMode(buttonPin, INPUT);
pinMode(ledPin, OUTPUT);
pinMode(Relay1, OUTPUT);
pinMode(Relay2, OUTPUT);
pinMode(Led1, OUTPUT);
pinMode(Led2, OUTPUT);

digitalWrite(ledPin, ledState);
digitalWrite(Relay1, relayState);
digitalWrite(Relay2, relayState);
digitalWrite(Led1, relayState);
digitalWrite(Led2, relayState);

}


void loop() {


// switchstate = digitalRead(buttonPin);
// starting state, no switch engaged, switchstate i lastswitchstate are LOW
// if any switch is engaged then switchstate while is ended

while (switchstate == lastswitchstate) {
switchstate = digitalRead(buttonPin);

digitalWrite(Led2, LOW);
digitalWrite(Led1, LOW);
digitalWrite(Relay1, HIGH);
digitalWrite(Relay2, HIGH);
digitalWrite(ledPin, HIGH);
delay(500);

}




// switch engaged switchstate and simultaneously le lastswitchstate LOW
// turn on LED 1 and with delay LED 2

//while (switchstate != lastswitchstate && lastswitchstate == LOW) {
digitalWrite(ledPin, LOW);
digitalWrite(Led1, HIGH);
digitalWrite(Relay1, LOW);
delay (5000);
digitalWrite(Led2, HIGH);
digitalWrite(Relay2, LOW);

lastswitchstate = LOW;
switchstate = LOW;


// waiting for any switch engaged, then relay is turned off

while (switchstate == lastswitchstate) {
switchstate = digitalRead(buttonPin);
delay(500);
}


// switchstate = digitalRead(buttonPin);
digitalWrite(ledPin, LOW);
digitalWrite(Led2, LOW);
digitalWrite(Relay2, HIGH);
delay (2000);
digitalWrite(Led1, LOW);
digitalWrite(Relay1, HIGH);
delay(500);
lastswitchstate = LOW;
switchstate = LOW;

}

const int buttonPin = 2; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin
const int Relay1 = 11; // relay 1 on pin 11
const int Relay2 = 12; // relay 2 on pin 12
const int Led1 = 9; // LED relay 1
const int Led2 = 10; // LED Relay 2


int ledState = HIGH; // the current state of the output pin
int relayState = HIGH;
int switchstate = LOW;
int lastswitchstate = LOW;



void setup() {
// put your setup code here, to run once:
pinMode(buttonPin, INPUT);
pinMode(ledPin, OUTPUT);
pinMode(Relay1, OUTPUT);
pinMode(Relay2, OUTPUT);
pinMode(Led1, OUTPUT);
pinMode(Led2, OUTPUT);

digitalWrite(ledPin, ledState);
digitalWrite(Relay1, relayState);
digitalWrite(Relay2, relayState);
digitalWrite(Led1, relayState);
digitalWrite(Led2, relayState);

}

void loop() {


// switchstate = digitalRead(buttonPin);
// starting state, no switch engaged, switchstate i lastswitchstate are LOW
// if any switch is engaged then switchstate while is ended

while (switchstate == lastswitchstate) {
switchstate = digitalRead(buttonPin);

digitalWrite(Led2, LOW);
digitalWrite(Led1, LOW);
digitalWrite(Relay1, HIGH);
digitalWrite(Relay2, HIGH);
digitalWrite(ledPin, HIGH);
delay(500);

}
// switch engaged switchstate and simultaneously le lastswitchstate LOW
// turn on LED 1 and with delay LED 2

//while (switchstate != lastswitchstate && lastswitchstate == LOW) {
digitalWrite(ledPin, LOW);
digitalWrite(Led1, HIGH);
digitalWrite(Relay1, LOW);
delay (5000);
digitalWrite(Led2, HIGH);
digitalWrite(Relay2, LOW);

lastswitchstate = LOW;
switchstate = LOW;


// waiting for any switch engaged, then relay is turned off

while (switchstate == lastswitchstate) {
switchstate = digitalRead(buttonPin);
delay(500);
}


// switchstate = digitalRead(buttonPin);
digitalWrite(ledPin, LOW);
digitalWrite(Led2, LOW);
digitalWrite(Relay2, HIGH);
delay (2000);
digitalWrite(Led1, LOW);
digitalWrite(Relay1, HIGH);
delay(500);
lastswitchstate = LOW;
switchstate = LOW;

}

Studio Jakubka Ostrava
Pro více informací a objednání nám napište email
Jakubská 39, Slezská Ostrava, 710 00
tel.: 777 642 159 nebo 775 642 159
Studio Jakubka Ostrava
Pro více informací a objednání nám napište email
Jakubská 39, Slezská Ostrava, 710 00
tel.: 777 642 159 nebo 775 642 159