Skip to content

Commit

Permalink
Lab1_esp in pdf;
Browse files Browse the repository at this point in the history
Lab2_avr example of REMAKing code;
Lab2_esp not ready;
Lab4 changed file name
  • Loading branch information
VladVanyuk committed Mar 12, 2024
1 parent 0099aa7 commit b5edd9b
Show file tree
Hide file tree
Showing 17 changed files with 2,636 additions and 116 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
#include "ESPAsyncWebServer.h"

// Set to true to define Relay as Normally Open (NO)
#define RELAY_NO false

// Set number of relays
#define NUM_RELAYS 1 // Set to 1 for a single relay

#define LED_NO false
#define BUTTON_PULLUP true
#define ESP_WIFI_MODE 2 //WIFI_STA // WIFI_AP //WIFI_AP_STA

// Assign GPIO to the relay
const int relayGPIO = D4; // Replace with the desired GPIO pin
// Assign GPIO to the relay and button
const int ledGPIO = D4; // Replace with the desired GPIO pin
const int btnGPIO = D5; // Replace with the desired GPIO pin

// Replace with your network credentials
const char* ssid = "WEMOS_ESP8266";
Expand Down Expand Up @@ -129,21 +127,47 @@ void initWiFi()
server.begin();
}

IRAM_ATTR void btnIsrHigh()
{
btnChangedFlag = true;
#if (BUTTON_PULLUP == true)
btnReleased = true;
#else
btnPressed = true;
#endif
}

IRAM_ATTR void btnIsrLow()
{
btnChangedFlag = true;
#if (BUTTON_PULLUP == true)
btnPressed = true;
#else
btnReleased = true;
#endif
}

void setup(){
Serial.begin(115200);
pinMode(relayGPIO, OUTPUT);
if(RELAY_NO){
digitalWrite(relayGPIO, HIGH);

pinMode(btnGPIO, INPUT_PULLUP);
// attachInterrupt(digitalPinToInterrupt(btnGPIO), btnIsrHigh, CHANGE);
attachInterrupt(digitalPinToInterrupt(btnGPIO), btnIsrHigh, RISING);
attachInterrupt(digitalPinToInterrupt(btnGPIO), btnIsrLow, FALLING);

pinMode(ledGPIO, OUTPUT);
if(LED_NO){ //! NOTE1
digitalWrite(ledGPIO, HIGH);
}
else{
digitalWrite(relayGPIO, LOW);
digitalWrite(ledGPIO, LOW);
}
initWiFi();

#if (RELAY_NO == true)
digitalWrite(relayGPIO, LOW);
#if (LED_NO == true) //! NOTE: tell the difference with NOTE1
digitalWrite(ledGPIO, LOW);
#else
digitalWrite(relayGPIO, HIGH);
digitalWrite(ledGPIO, HIGH);
#endif

}
Expand All @@ -153,15 +177,14 @@ void loop() {
{
if (btnPressed)
{
digitalWrite(relayGPIO, LOW);
digitalWrite(ledGPIO, LOW);
btnPressed = false;
}
if (btnReleased)
{
digitalWrite(relayGPIO, HIGH);
digitalWrite(ledGPIO, HIGH);
btnReleased = false;
}
btnChangedFlag = false;
}

}
Binary file not shown.
237 changes: 237 additions & 0 deletions mc_labs/mc_lab_02/build/arduino.avr.mega/sketch_mar01a.ino.mega.hex
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
:1000000007C1000033C1000031C100002FC1000052
:100010002DC100002BC1000029C1000027C1000034
:1000200025C1000023C1000021C100001FC1000044
:100030001DC100001BC1000019C1000017C1000054
:1000400015C1000013C1000011C100000FC1000064
:100050000DC100000BC1000009C1000085C40000F3
:1000600005C10000F4C40000C9C40000FFC00000C6
:10007000FDC00000FBC00000F9C00000F7C0000098
:10008000F5C00000F3C00000F1C00000EFC00000A8
:10009000EDC00000EBC00000E9C00000E7C00000B8
:1000A000E5C00000E3C00000E1C00000DFC00000C8
:1000B000DDC00000DBC00000D9C00000D7C00000D8
:1000C000D5C00000D3C00000D1C00000CFC00000E8
:1000D000CDC00000CBC00000C9C00000C7C00000F8
:1000E000C5C000006501680157015B015F019F0108
:1000F0006C01700176017A017E01840188018C0116
:100100009F01920196019A0100002100240027001E
:100110002A002D0030003300010100000401070116
:100120000A0100002200250028002B002E003100CB
:10013000340002010000050108010B010505050559
:10014000070508080808020202020A0A080804044F
:10015000040401010101010101010303030303037D
:100160000303040707070C0C0C0C0C0C0C0C02020C
:10017000020206060606060606060B0B0B0B0B0B09
:100180000B0B010210202008081020401020408096
:10019000020102010804020101020408102040804B
:1001A00080402010080402018004020180402010D9
:1001B0000804020108040201010204081020408022
:1001C000010204081020408000000A0B02090C0DF7
:1001D0000E080703040100000000000000000000FA
:1001E000000000000000000000000000000000000F
:1001F00000000000121110000000000000000000CC
:1002000000000000000000000000000000005D058C
:1002100011241FBECFEFD1E2DEBFCDBF00E00CBF87
:1002200012E0A0E0B2E0E4E4FEE000E00BBF02C0B8
:1002300007900D92A436B107D9F723E0A4E6B2E007
:1002400001C01D92A732B207E1F711E0C8E0D1E08A
:1002500000E005C021970109802FFE01E5D5C730D8
:10026000D10780E00807B1F771D4EAC5C9CE362FAF
:1002700090E0FC01E853FE4F4491FC01EE57FE4F25
:100280002491FC01E45CFE4F9491992309F46BC026
:10029000442309F454C050E0FA013197E231F105EA
:1002A00008F04DC08827EE58FF4F8F4FBDC5809195
:1002B00080008F7707C0809180008F7D03C0809180
:1002C0008000877F809380003AC084B58F7702C01A
:1002D00084B58F7D84BD33C08091B0008F7703C01B
:1002E0008091B0008F7D8093B00029C080919000F4
:1002F0008F7707C0809190008F7D03C08091900020
:10030000877F809390001BC08091A0008F7707C0EB
:100310008091A0008F7D03C08091A000877F809393
:10032000A0000DC0809120018F7707C0809120012F
:100330008F7D03C080912001877F80932001E92F6A
:10034000F0E0EE0FFF1FEE5DFE4FA591B4919FB759
:10035000F894311104C08C912095282302C0EC91AF
:100360002E2B2C939FBF0895CF93DF9390E0FC0139
:10037000EE57FE4F2491FC01E45CFE4F84918823EC
:1003800061F190E0880F991FFC01E85FFE4FC59175
:10039000D491FC01EE5DFE4FA591B491611109C0AD
:1003A0009FB7F8948881209582238883EC912E232F
:1003B0000BC0623061F49FB7F8948881322F30957A
:1003C00083238883EC912E2B2C939FBF06C08FB77D
:1003D000F894E8812E2B28838FBFDF91CF91089569
:1003E000CF92DF92EF92FF920F931F93CF93DF9301
:1003F0006C017A018B01C0E0D0E0CE15DF0581F001
:10040000D8016D918D01D601ED91FC910190F081A3
:10041000E02DC6011995892B11F02196EECF7E01B2
:10042000C701DF91CF911F910F91FF90EF90DF9067
:10043000CF900895FC01538D448D252F30E0842FFB
:1004400090E0821B930B541710F0CF9608950197FC
:100450000895FC01918D828D981761F0828DDF01E6
:10046000A80FB11D5D968C91928D9F5F9F73928FA7
:1004700090E008958FEF9FEF0895FC01918D828D9C
:10048000981731F0828DE80FF11D858D90E0089569
:100490008FEF9FEF0895FC01918D228D892F90E0C1
:1004A000805C9F4F821B91098F739927089582E783
:1004B00092E0F1DF21E0892B09F420E0822F0895FA
:1004C000FC01848DDF01A80FB11DA35ABF4F2C91F1
:1004D000848D90E001968F739927848FA689B789C0
:1004E0002C93A089B1898C91837080648C93938DB7
:1004F000848D981306C00288F389E02D80818F7D5A
:1005000080830895EF92FF920F931F93CF93DF9311
:10051000EC0181E0888F9B8D8C8D981305C0E88954
:10052000F989808185FD25C0F62E0B8D10E00F5FC7
:100530001F4F0F731127E02E8C8DE8120BC00FB6E2
:1005400007FCFACFE889F989808185FFF5CFCE01D4
:10055000B7DFF2CF8B8DFE01E80FF11DE35AFF4F9D
:10056000F0829FB7F8940B8FEA89FB8980818062C3
:100570000AC09FB7F894EE89FF896083E889F989FA
:1005800080818370806480839FBF81E090E0DF91F1
:10059000CF911F910F91FF90EF900895CF93DF932C
:1005A000EC01888D8823C1F0EA89FB89808185FD73
:1005B00005C0A889B9898C9186FD0EC00FB607FCCD
:1005C000F5CF808185FFF2CFA889B9898C9185FF0D
:1005D000EDCFCE0175DFE8CFDF91CF91089580E0B8
:1005E00090E0892B19F063DF811125C080E090E055
:1005F000892B41F080E090E0892B21F00E940000DF
:1006000081111CC080E090E0892B41F080E090E0F7
:10061000892B21F00E940000811113C080E090E03E
:10062000892BA1F080E090E0892B81F00E940000EE
:1006300081110AC008950E940000D8CF0E940000D6
:10064000E1CF0E940000EACF0C9400000895CF9300
:10065000DF93EC0160E08E810ADE61E08E8107DECF
:1006600060E08E8104DE8BE891E00197F1F7DF9185
:10067000CF910895CF92DF92EF92FF920F931F9345
:10068000CF93DF936C017C0187E0E80EF11CC0E0A2
:10069000D0E0062F10E0B8010C2E02C075956795CA
:1006A0000A94E2F76170F70181917F01E0DD219604
:1006B000C430D10581F7C601DF91CF911F910F9111
:1006C000FF90EF90DF90CF90C2CFCF92DF92EF926A
:1006D000FF920F931F93CF93DF93EC01F62E642FBD
:1006E0008C81C5DD8D818F3F11F060E0C0DD8F858D
:1006F0000F2D10E084FF23C06E0187E0C80ED11CCF
:10070000E12CF12CB8010E2C02C0759567950A9466
:10071000E2F76170F60181916F01A9DDFFEFEF1A39
:10072000FF0A88E0E816F10469F7CE01DF91CF9166
:100730001F910F91FF90EF90DF90CF9088CFB8017D
:1007400084E0759567958A95E1F7CE0193DF6F2D6B
:10075000CE01DF91CF911F910F91FF90EF90DF902D
:10076000CF9088CF40E0682F8FE093E0AECFCF935B
:10077000DF93823028F090911E03986090931E03BF
:10078000809322031092230380E48093240380E16A
:100790008093250380E58093260361E08091130315
:1007A000E3DD809114038F3F11F061E0DDDD61E056
:1007B00080911503D9DDCFE0D3E09E012F50334067
:1007C00080911E0384FD03C084E090E002C088E0B5
:1007D00090E021962817390724F461E08E81C4DD6A
:1007E000ECCF8BE39DE00197F1F760E0809113037C
:1007F0003EDD60E0809115033ADD809114038F3F68
:1008000011F060E034DD80911E0384FD1CC063E0C4
:100810008FE093E02FDFCBE4D6E4CE010197F1F730
:1008200063E08FE093E026DF2197F1F763E08FE04C
:1008300093E020DF83E592E00197F1F762E08FE03B
:1008400093E018DF12C080628DDF8BE496E401979D
:10085000F1F780911E03806285DF83E592E00197C6
:10086000F1F780911E0380627DDF80911E0380621C
:1008700079DF84E080931F038CE074DF81E072DF16
:100880008BE39FE10197F1F782E08093200386E0FC
:10089000DF91CF9167CF643008F063E0909122033D
:1008A000691710F06FEF690FE62FF0E0E15FFC4F82
:1008B0009489890F806856CF41E007DF81E090E09E
:1008C0000895089580E090E00895009761F0FC019C
:1008D00001900020E9F73197AF01481B590BBC018B
:1008E0008FE093E07DCD80E090E00895EECFCF9251
:1008F000DF92EF92FF920F931F93CF93DF93CDB7C9
:10090000DEB7A1970FB6F894DEBF0FBECDBF282F7C
:1009100030E040E050E019A28E010F5D1F4F8AE0E9
:10092000C82ED12CE12CF12CCA01B901A7019601E6
:1009300059D2605DF80162938F012115310541059F
:10094000510591F7CF01C1DFA1960FB6F894DEBF34
:100950000FBECDBFDF91CF911F910F91FF90EF9010
:10096000DF90CF90089568D21F920F920FB60F922A
:1009700011242F933F938F939F93AF93BF938091B5
:100980006E0290916F02A0917002B091710230914D
:100990006D0223E0230F2D3720F40196A11DB11D18
:1009A00005C026E8230F0296A11DB11D20936D02FC
:1009B00080936E0290936F02A0937002B0937102C5
:1009C0008091690290916A02A0916B02B0916C02D1
:1009D0000196A11DB11D8093690290936A02A093B4
:1009E0006B02B0936C02BF91AF919F918F913F9139
:1009F0002F910F900FBE0F901F9018951F920F927E
:100A00000FB60F9211240BB60F922F933F934F9373
:100A10005F936F937F938F939F93AF93BF93EF9366
:100A2000FF9382E792E04CDDFF91EF91BF91AF9190
:100A30009F918F917F916F915F914F913F912F91F6
:100A40000F900BBE0F900FBE0F901F9018951F9226
:100A50000F920FB60F9211240BB60F922F938F9314
:100A60009F93EF93FF93E0918202F0918302808144
:100A7000E0918802F091890282FD12C090818091FC
:100A80008B028F5F8F7320918C02821751F0E0915F
:100A90008B02F0E0EE58FD4F958F80938B0201C0E2
:100AA0008081FF91EF919F918F912F910F900BBEBD
:100AB0000F900FBE0F901F901895E2E7F2E013829F
:100AC000128288EE93E0A0E0B0E084839583A68351
:100AD000B78385E092E09183808385EC90E09587F1
:100AE000848784EC90E09787868780EC90E0918BF8
:100AF000808B81EC90E0938B828B82EC90E0958BE5
:100B0000848B86EC90E0978B868B118E128E138EE1
:100B1000148EEFE0F3E01382128287E192E091837A
:100B2000808385E0848386E0858387E0868388E010
:100B3000878389E080878AE081878BE082871386BC
:100B4000148615861686178681E011CE789484B5B2
:100B5000826084BD84B5816084BD85B5826085BDB9
:100B600085B5816085BD80916E00816080936E0047
:100B70001092810080918100826080938100809139
:100B800081008160809381008091800081608093EA
:100B900080008091B10084608093B1008091B000AA
:100BA00081608093B0008091910082608093910079
:100BB000809191008160809391008091900081608C
:100BC000809390008091A10082608093A100809129
:100BD000A10081608093A1008091A000816080933A
:100BE000A0008091210182608093210180912101E8
:100BF0008160809321018091200181608093200198
:100C000080917A00846080937A0080917A0082607B
:100C100080937A0080917A00816080937A0080913D
:100C20007A00806880937A001092C100E09182027D
:100C3000F091830282E08083E0917E02F0917F0256
:100C40001082E0918002F09181028FEC80831092FB
:100C50008A02E0918602F091870286E08083E0912B
:100C60008402F0918502808180618083E09184021A
:100C7000F0918502808188608083E0918402F09108
:100C80008502808180688083E0918402F0918502F2
:100C900080818F7D808361E08DE066DB60E08DE0A8
:100CA000E6DA62E086E160DB82E061DD8FE192E01E
:100CB0001DDE83EA84BD83E085BD17BC18BC279A7E
:100CC0009D9A11E003EB83EAF82E82E792E0E3DBE2
:100CD000892B09F47DC082E792E0BBDBEC018091B7
:100CE0000002882309F444C0C13AD10559F4809127
:100CF000680287BD1093670260E080E0CCDD8CE283
:100D000092E00BC0C23AD10559F417BC10926702A9
:100D100060E080E0C0DD8DE392E0E8DD87B524C0CF
:100D2000C33AD10529F410920002F092660250C035
:100D3000C13BD10559F48091650288BD10936402CE
:100D400061E080E0A8DD8AE492E00CC0C23BD105FE
:100D500009F040C018BC1092640261E080E09BDDA5
:100D600087E592E0C3DD88B5C2DD89E392E02FC05C
:100D700080916602833AA1F410930002C093680246
:100D800080916702882321F1C7BD60E087E083DDA1
:100D900084E492E0ABDD87B5AADD8AE392E0A6DDCC
:100DA00080916602833BA1F410930002C093650218
:100DB00080916402882361F0C8BD61E087E06BDD4B
:100DC0008EE592E093DD88B592DD8AE392E08EDDD8
:100DD00006DC7BCFC33BD105D9F71092000200930C
:100DE0006602F6CFA1E21A2EAA1BBB1BFD010DC0A5
:100DF000AA1FBB1FEE1FFF1FA217B307E407F507CB
:100E000020F0A21BB30BE40BF50B661F771F881FA6
:100E1000991F1A9469F760957095809590959B013C
:100E2000AC01BD01CF010895EE0FFF1F881F8BBFDE
:100E30000790F691E02D199481E090E0F89400C0BD
:040E4000F894FFCF54
:100E440001000000008202F0011A02CE024B0229C6
:100E5400023D02000000005C04F0016204610453DE
:100E64007461727420436C69656E740053746172AA
:100E74007441204F4352413D002020200053746FA1
:100E8400704120204F4352413D00537461727442BB
:100E9400204F4352423D0053746F704220204F4311
:040EA40052423D0079
:00000001FF
Loading

0 comments on commit b5edd9b

Please sign in to comment.