Arduino

Class: Technology, Arduino I/O

Software: Arduino IDE, Windows 10

Hardware: Arduino Uno, Arduino Nano, Bluetooth module  HC-05, Relay KY,  Battery 9v, Breadboard

Challenges: learn how to work with Arduino, Arduino Ide and it-s libraries

         
//
#define E1 3 
#define E2 5 

int val;
void setup()
{
pinMode(E1,OUTPUT);
pinMode(E2,OUTPUT);
Serial.begin(9600);
}
void Rele1(void) 
{

digitalWrite(E1,HIGH); 

}

void Rele11(void) 
{

digitalWrite(E1,LOW); 

}

void Rele2(void) 
{
digitalWrite(E2,HIGH);

}

void Rele22(void)
{
digitalWrite(E2,LOW); 

}

void loop()
{
val=Serial.read();

if(val=='a') Rele1();
if(val=='s') Rele11();
if(val=='q') Rele2();
if(val=='w') Rele22();

}
 
//
#define E1 3 
#define E3 2
#define E2 5 
#define E4 4

int val;
void setup()
{
pinMode(E1,OUTPUT);
pinMode(E2,OUTPUT);
pinMode(E3,OUTPUT);
pinMode(E4,OUTPUT);
Serial.begin(9600);
}
void Rele1(void) 
{

digitalWrite(E1,HIGH); 
delay(20000);
digitalWrite(E1,HIGH);
digitalWrite(E3,HIGH);
delay(8000);
digitalWrite(E1,LOW);
digitalWrite(E3,HIGH);
delay(3000);
digitalWrite(E3,LOW);

}

 

void Rele2(void) 

digitalWrite(E2,HIGH); 
delay(20000);
digitalWrite(E2,HIGH);
digitalWrite(E4,HIGH);
delay(8000);
digitalWrite(E2,LOW);
digitalWrite(E4,HIGH);
delay(3000);
digitalWrite(E4,LOW);

}

 

void loop()
{
val=Serial.read();

if(val=='a') Rele1();

if(val=='q') Rele2();

 

}
Useful links:  https://www.arduino.cc/en/main/software http://wiki.amperka.ru/%D1%83%D1%81%D1%82%D0%B0%D0%BD%D0%BE%D0%B2%D0%BA%D0%B0-%D0%B8-%D0%BD%D0%B0%D1%81%D1%82%D1%80%D0%BE%D0%B9%D0%BA%D0%B0-arduino-ide http://arduino.ru/Arduino_environment https://geektimes.ru/post/274376/

Trackback from your site.

address: 20 Myasnitskaya ulitsa
(metro stations ‘Lubyanka’ and ‘Kitay-Gorod’)
Moscow 101000 Russia

phone: +7(495)772-95-90 *15026

email: city@hse.ru