From 5e237c8850c979c8ea4208da8530539c899e24d6 Mon Sep 17 00:00:00 2001 From: rhinemann Date: Wed, 15 Oct 2025 23:20:34 +0300 Subject: [PATCH] first commit --- lab_4/task_1.ino | 17 +++++++++++++++++ lab_4/task_1.pcf | 15 +++++++++++++++ lab_4/task_2.ino | 34 ++++++++++++++++++++++++++++++++++ lab_4/task_2.pcf | 16 ++++++++++++++++ lab_4/task_3.ino | 19 +++++++++++++++++++ lab_4/task_4.ino | 31 +++++++++++++++++++++++++++++++ lab_4/task_5.ino | 44 ++++++++++++++++++++++++++++++++++++++++++++ lab_4/task_5.pcf | 14 ++++++++++++++ 8 files changed, 190 insertions(+) create mode 100644 lab_4/task_1.ino create mode 100644 lab_4/task_1.pcf create mode 100644 lab_4/task_2.ino create mode 100644 lab_4/task_2.pcf create mode 100644 lab_4/task_3.ino create mode 100644 lab_4/task_4.ino create mode 100644 lab_4/task_5.ino create mode 100644 lab_4/task_5.pcf diff --git a/lab_4/task_1.ino b/lab_4/task_1.ino new file mode 100644 index 0000000..e8d96ec --- /dev/null +++ b/lab_4/task_1.ino @@ -0,0 +1,17 @@ +#include +#include + +LiquidCrystal_I2C lcd(0x27, 16, 2); + +void setup() { + lcd.init(); + lcd.backlight(); + lcd.print("Andrew"); + lcd.setCursor(0, 1); + lcd.print("Shved"); +} + +void loop() { + lcd.scrollDisplayLeft(); + delay(100); +} diff --git a/lab_4/task_1.pcf b/lab_4/task_1.pcf new file mode 100644 index 0000000..9d26746 --- /dev/null +++ b/lab_4/task_1.pcf @@ -0,0 +1,15 @@ +version,0,0,0:0.9.2 +scale,0,0,0:0.900000 +position,1427,459,855:407 +boardp,1582,0,700:430 +spare_on,0,0,0:1 +osc_on,0,0,0:0 +useAlias,0,0,0:0 +debug,0,1,0: +osc_cfg,1037,217,0:1.000000,0.000000,1,1,2.500000,0,5,1,0,0 +osc_ch1,0,0,0:2.000000,0.000000,1,#FF0000,0,18 PB4/12 +osc_ch2,0,0,0:2.000000,0.000000,0,#00FF00,0,8 GND +Text Box,213,12,0:12,5,4,https://lcgamboa.github.io/picsimlab_examples/board_Arduino_Uno.html#board_Arduino_Uno_atmega328p_stepper_onerevolution%Examplesource info +IO Virtual Term,11,11,0:3,2,1,9600,1,1931,528,530,400 +IO PCF8574,8,194,0:28,27,0,0,0,110 +LCD hd44780,454,13,0:110,112,8,8,8,8,114,115,116,117,111,1 diff --git a/lab_4/task_2.ino b/lab_4/task_2.ino new file mode 100644 index 0000000..2322f45 --- /dev/null +++ b/lab_4/task_2.ino @@ -0,0 +1,34 @@ +#include +#include + +const int TEMPERATURE_SENSOR_IN = A0; +float temperature_value = 0; + +LiquidCrystal_I2C lcd(0x27, 16, 2); + +inline float get_C_temperature() { + return analogRead(TEMPERATURE_SENSOR_IN) * (5.0 / 1023.0) * 100; +} + +inline float C_to_F_temperature(float C_temperature) { + return (C_temperature * 9.0 / 5.0) + 32.0; +} + +void setup() { + lcd.init(); + lcd.backlight(); + lcd.print("T:"); + lcd.setCursor(10, 0); + lcd.print("C"); + lcd.setCursor(10, 1); + lcd.print("F"); +} + +void loop() { + temperature_value = get_C_temperature(); + lcd.setCursor(3, 0); + lcd.print(temperature_value); + lcd.setCursor(3, 1); + lcd.print(C_to_F_temperature(temperature_value)); + delay(100); +} diff --git a/lab_4/task_2.pcf b/lab_4/task_2.pcf new file mode 100644 index 0000000..7a665e9 --- /dev/null +++ b/lab_4/task_2.pcf @@ -0,0 +1,16 @@ +version,0,0,0:0.9.2 +scale,0,0,0:0.900000 +position,1427,606,855:761 +boardp,1427,0,855:577 +spare_on,0,0,0:1 +osc_on,0,0,0:0 +useAlias,0,0,0:0 +debug,0,1,0: +osc_cfg,1037,217,0:1.000000,0.000000,1,1,2.500000,0,5,1,0,0 +osc_ch1,0,0,0:2.000000,0.000000,1,#FF0000,0,18 PB4/12 +osc_ch2,0,0,0:2.000000,0.000000,0,#00FF00,0,8 GND +Text Box,213,12,0:12,5,4,https://lcgamboa.github.io/picsimlab_examples/board_Arduino_Uno.html#board_Arduino_Uno_atmega328p_stepper_onerevolution%Examplesource info +IO Virtual Term,11,11,0:3,2,1,9600,1,1931,528,530,400 +IO PCF8574,8,194,0:28,27,0,0,0,110 +LCD hd44780,454,13,0:110,112,8,8,8,8,114,115,116,117,111,1 +LM35 (Temperature),10,379,1:23,0 diff --git a/lab_4/task_3.ino b/lab_4/task_3.ino new file mode 100644 index 0000000..67b4fa0 --- /dev/null +++ b/lab_4/task_3.ino @@ -0,0 +1,19 @@ +#include +#include + +const char surname[] = {'S', 'h', 'w', 'e', 'd'}; + +LiquidCrystal_I2C lcd(0x27, 16, 2); + +void setup() { + lcd.init(); + lcd.backlight(); + for (int i = i; i < sizeof(surname) / sizeof(char); ++i) { + lcd.setCursor(i, i % 2); + lcd.print(surname[i]); + } +} + +void loop() { + +} diff --git a/lab_4/task_4.ino b/lab_4/task_4.ino new file mode 100644 index 0000000..ddd15d0 --- /dev/null +++ b/lab_4/task_4.ino @@ -0,0 +1,31 @@ +#include +#include + +const uint8_t sh[] = { 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x1F }; +const uint8_t a[] = { 0x0, 0x0, 0x0, 0x1E, 0x11, 0x1E, 0x11, 0x1E }; +const uint8_t e[] = { 0x0, 0x0, 0x0, 0x1F, 0x10, 0x1F, 0x10, 0x1F }; +const uint8_t d[] = { 0x0, 0x0, 0x0, 0xE, 0xA, 0xA, 0x1F, 0x11 }; +const char surname[] = {'S', 'h', 'w', 'e', 'd'}; + +LiquidCrystal_I2C lcd(0x27, 16, 2); + +void setup() { + lcd.init(); + lcd.backlight(); + + lcd.createChar(0, sh); + lcd.createChar(1, a); + lcd.createChar(2, e); + lcd.createChar(3, d); + + + lcd.setCursor(0, 0); + lcd.write(0); + lcd.write(1); + lcd.write(2); + lcd.write(3); +} + +void loop() { + +} diff --git a/lab_4/task_5.ino b/lab_4/task_5.ino new file mode 100644 index 0000000..125be6e --- /dev/null +++ b/lab_4/task_5.ino @@ -0,0 +1,44 @@ +#include +#include +#include +#include + +#define POTENTIOMETER_IN A0 +#define SCREEN_WIDTH 128 +#define SCREEN_HEIGHT 64 + +Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1); + +int i, wave = 0; + +void setup() { + Serial.begin(115200); + + if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { + Serial.println("SSD1306 allocation failed"); + for (;;); + } + delay(2000); + + display.setFont(&FreeMono9pt7b); + display.clearDisplay(); + display.setTextSize(1); + display.setTextColor(WHITE); + display.setCursor(0, 20); + display.println("Shved\nAndrii\nIO-23"); + display.display(); + delay(3000); +} + +void loop() { + display.clearDisplay(); + + for (i = 0; i < SCREEN_WIDTH; ++i) { + wave = analogRead(POTENTIOMETER_IN); + wave = map(wave, 0, 1023, SCREEN_HEIGHT - 1, 0); + wave = constrain(wave, 0, SCREEN_HEIGHT); + + display.drawPixel(i, wave, WHITE); + display.display(); + } +} diff --git a/lab_4/task_5.pcf b/lab_4/task_5.pcf new file mode 100644 index 0000000..6ed4a36 --- /dev/null +++ b/lab_4/task_5.pcf @@ -0,0 +1,14 @@ +version,0,0,0:0.9.2 +scale,0,0,0:1.900000 +position,1427,606,855:761 +boardp,1427,0,855:577 +spare_on,0,0,0:1 +osc_on,0,0,0:0 +useAlias,0,0,0:0 +debug,0,1,0: +osc_cfg,1037,217,0:1.000000,0.000000,1,1,2.500000,0,5,1,0,0 +osc_ch1,0,0,0:2.000000,0.000000,1,#FF0000,0,18 PB4/12 +osc_ch2,0,0,0:2.000000,0.000000,0,#00FF00,0,8 GND +IO Virtual Term,11,11,0:3,2,1,9600,1,1061,89,530,400 +LCD ssd1306,244,11,0:28,27,0,0,0,1 +Potentiometers,10,178,1:23,0,0,0,12,0,0,0,1