16 Şubat 2019 Cumartesi

Arduino relay control




Programs:
Proteus 8 Professional
Arduino 1.8.8
files (Arduino file, hex file, Proteus project file)


C:

// Basic 4 Realy board connection

// Each relay is turned on for 2 seconds and then off.

// You can here them click as there state changes from off to on and on to

// off.

// You will also see the corresponding Red LED on the 4 Relay board

// light up when the relay is on.



 //  define names for the 4 Digital pins On the Arduino   

// These data pins link to 4 Relay board pins IN1, IN2, IN3,



#define RELAY1  6                        

#define RELAY2  7                        

#define RELAY3  8                        

#define RELAY4  9



void setup()

{    

// Initialise the Arduino data pins for OUTPUT

  pinMode(RELAY1, OUTPUT);       

  pinMode(RELAY2, OUTPUT);

  pinMode(RELAY3, OUTPUT);

  pinMode(RELAY4, OUTPUT);

}



 void loop()

{

   digitalWrite(RELAY1,LOW);           // Turns ON Relays 1

   delay(100);                                      // Wait 1/10 seconds  2000==> 2second

   digitalWrite(RELAY1,HIGH);          // Turns Relay Off



   digitalWrite(RELAY2,LOW);           // Turns ON Relays 2

   delay(100);                                      // Wait  (2000 for 2 second)

   digitalWrite(RELAY2,HIGH);          // Turns Relay Off



   digitalWrite(RELAY3,LOW);           // Turns ON Relays 3

   delay(100);                                      // Wait

   digitalWrite(RELAY3,HIGH);          // Turns Relay Off



   digitalWrite(RELAY4,LOW);           // Turns ON Relays 4

   delay(100);                                      // Wait 

   digitalWrite(RELAY4,HIGH);          // Turns Relay Off        

 }

HEX:

:100000000C945C000C946E000C946E000C946E00CA
:100010000C946E000C946E000C946E000C946E00A8
:100020000C946E000C946E000C946E000C946E0098
:100030000C946E000C946E000C946E000C946E0088
:100040000C9438010C946E000C946E000C946E00AD
:100050000C946E000C946E000C946E000C946E0068
:100060000C946E000C946E00000000080002010069
:100070000003040700000000000000000000000072
:10008000250028002B0000000000240027002A0083
:10009000040404040404040402020202020203032E
:1000A0000303030301020408102040800102040836
:1000B000102001020408102011241FBECFEFD8E049
:1000C000DEBFCDBF21E0A0E0B1E001C01D92A930AC
:1000D000B207E1F70E9482010C9400020C94000028
:1000E00090E0FC01EC55FF4F2491FC01E057FF4FDD
:1000F0008491882399F090E0880F991FFC01EA57BA
:10010000FF4FA591B491FC01E458FF4F8591949164
:100110008FB7F894EC91E22BEC938FBF089590E0A9
:10012000FC01E859FF4F2491FC01EC55FF4F34913D
:10013000FC01E057FF4FE491EE2309F43CC0222379
:1001400039F1233091F038F42130A9F0223001F553
:1001500084B58F7D12C0273091F02830A1F0243073
:10016000B9F4809180008F7D03C0809180008F77EB
:10017000809380000DC084B58F7784BD09C08091C5
:10018000B0008F7703C08091B0008F7D8093B00066
:10019000F0E0EE0FFF1FE458FF4FA591B4919FB719
:1001A000F894611104C08C913095382302C0EC9111
:1001B0003E2B3C939FBF08953FB7F8948091050173
:1001C00090910601A0910701B091080126B5A89B66
:1001D00005C02F3F19F00196A11DB11D3FBFBA2FD9
:1001E000A92F982F8827820F911DA11DB11DBC0139
:1001F000CD0142E0660F771F881F991F4A95D1F7FE
:1002000008958F929F92AF92BF92CF92DF92EF921A
:10021000FF920E94DC004B015C0184E6C82ED12CC9
:10022000E12CF12C0E94DC00DC01CB01881999093A
:10023000AA09BB09883E9340A105B10598F321E0C6
:10024000C21AD108E108F10888EE880E83E0981EF2
:10025000A11CB11CC114D104E104F10419F7FF90F1
:10026000EF90DF90CF90BF90AF909F908F900895C8
:100270001F920F920FB60F9211242F933F938F93DB
:100280009F93AF93BF938091010190910201A09140
:100290000301B09104013091000123E0230F2D37B9
:1002A00020F40196A11DB11D05C026E8230F02967A
:1002B000A11DB11D209300018093010190930201C3
:1002C000A0930301B0930401809105019091060170
:1002D000A0910701B09108010196A11DB11D809365
:1002E000050190930601A0930701B0930801BF9107
:1002F000AF919F918F913F912F910F900FBE0F90D3
:100300001F901895789484B5826084BD84B581600F
:1003100084BD85B5826085BD85B5816085BD8091D0
:100320006E00816080936E00109281008091810048
:100330008260809381008091810081608093810040
:10034000809180008160809380008091B100846002
:100350008093B1008091B00081608093B000809163
:100360007A00846080937A0080917A008260809322
:100370007A0080917A00816080937A0080917A007F
:10038000806880937A001092C10086E00E9470001D
:1003900087E00E94700088E00E94700089E00E945F
:1003A0007000C0E0D0E060E086E00E948F000E9414
:1003B000010161E086E00E948F0060E087E00E941A
:1003C0008F000E94010161E087E00E948F0060E0E1
:1003D00088E00E948F000E94010161E088E00E9495
:1003E0008F0060E089E00E948F000E94010161E0BF
:1003F00089E00E948F002097B1F20E940000D3CFC5
:04040000F894FFCF9E
:00000001FF




Hiç yorum yok:

Yorum Gönder