Dodajem treće i četvrto predavanje.

This commit is contained in:
2024-04-10 09:13:23 +02:00
parent 2e95796816
commit 44c02255b4
14 changed files with 209 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,2 @@
default_port: /dev/ttyUSB0
default_fqbn: arduino:avr:uno

View File

@@ -0,0 +1,21 @@
const int temp_sensor = A0; // Senzor je povezan na A0
float sensor_value;
float voltage;
float temperaturaK = 0;
float temperatura = 0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
sensor_value = analogRead(temp_sensor); // Očitana vrednost sa ADC-a
voltage = sensor_value * 5000 / 1024; // Napon u milivoltima
temperaturaK = voltage / 10; // Temperatura u kelvinima
temperatura = temperaturaK - 273.16; // Temperatura u celzijusima
Serial.println(temperatura);
delay(100);
}