first commit

This commit is contained in:
rhinemann 2025-10-15 23:20:34 +03:00
commit 5e237c8850
8 changed files with 190 additions and 0 deletions

17
lab_4/task_1.ino Normal file
View File

@ -0,0 +1,17 @@
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
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);
}

15
lab_4/task_1.pcf Normal file
View File

@ -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

34
lab_4/task_2.ino Normal file
View File

@ -0,0 +1,34 @@
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
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);
}

16
lab_4/task_2.pcf Normal file
View File

@ -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

19
lab_4/task_3.ino Normal file
View File

@ -0,0 +1,19 @@
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
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() {
}

31
lab_4/task_4.ino Normal file
View File

@ -0,0 +1,31 @@
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
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() {
}

44
lab_4/task_5.ino Normal file
View File

@ -0,0 +1,44 @@
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Fonts/FreeMono9pt7b.h>
#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();
}
}

14
lab_4/task_5.pcf Normal file
View File

@ -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