How to make a heat sensor at home?

In this section, I will tell you how to measure values such as heat and humidity. Basically, we have some requirements.

Arduino Uno or make connections to the device as shown in the figure. Then open the Arduino IDE and compile the project in the Arduino IDE and transfer it to the device using the following codes.

#include <dht11.h>
int DHT11_pin=2;
dht11 DHT11_sensor;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  int chk = DHT11_sensor.read(DHT11_pin);
  

  int data=Serial.read();

  if(data=='1')
  {
    Serial.println((float)DHT11_sensor.humidity, 2);
  }
  else if(data=='2')
  {
    Serial.println((float)DHT11_sensor.temperature, 2);
  }
  else if(data=='3')
  {
    Serial.println(DHT11_sensor.dewPoint(), 2);
  }
}

When you enter “1” value from the serial port screen and enter, it will give the humidity value. If you type 2 through the serial port screen, it will give the temperature. We used dewPoint function as a third option. You can improve too. The values you receive are a 3. in the batch application, you can start using it by connecting to the serial port screen.

We wrote a program in Turkish. Name of the program: Temperature Sensor.

This program is a simple program that automatically reads values through Arduino Uno. Values async as realtime as Form1.in our cs file, we read from the serial port and print live to the screen.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO.Ports;
using System.Threading;
using System.Globalization;

namespace HararetSensoru
{
    public partial class Form1 : Form
    {
        SerialPort sp;
        float nem;
        float sicaklik;
        float cig;
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            string[] ports = SerialPort.GetPortNames();

            foreach(string port in ports)
            {
                listBox1.Items.Add(port);
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            button1.Enabled = false;

            if (listBox1.SelectedItem != null)
            {
                sp = new SerialPort(listBox1.SelectedItem.ToString(), 9600, Parity.None, 8, StopBits.One);
                sp.Open();

                ReadValues();
            }
            else
            {
                button1.Enabled = true;
                MessageBox.Show("Port seçtin mi?", "ROM port hatası", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

        }

        private async void ReadValues()
        {
            await Task.Run(() =>
            {
                while (true)
                {
                    SetStatus("Okunuyor...");
                    sp.Write("1");
                    nem = (float)Math.Round(float.Parse(sp.ReadLine(), CultureInfo.InvariantCulture.NumberFormat));
                    ChangeLabel1Text(nem.ToString()+" %");
                    ChangeProgressBar1((int)(nem));

                    sp.Write("2");
                    sicaklik = (float)Math.Round(float.Parse(sp.ReadLine(), CultureInfo.InvariantCulture.NumberFormat));
                    ChangeLabel2Text(sicaklik.ToString()+" 'C");
                    ChangeProgressBar2((int)(sicaklik));

                    sp.Write("3");
                    cig = (float)Math.Round(float.Parse(sp.ReadLine(), CultureInfo.InvariantCulture.NumberFormat));
                    ChangeLabel3Text(cig.ToString()+" %");
                    ChangeProgressBar3((int)(cig));
                    SetStatus("Okundu.");

                    System.Threading.Thread.Sleep(1000); // time to sleep thread
                }
            });
        }

        private void ChangeLabel1Text(string value)
        {
            if (label1.InvokeRequired)
            {
                label1.Invoke(new Action<string>(ChangeLabel1Text), value);
                return;
            }
            label1.Text = value;
        }


        private void ChangeLabel2Text(string value)
        {
            if (label2.InvokeRequired)
            {
                label2.Invoke(new Action<string>(ChangeLabel2Text), value);
                return;
            }
            label2.Text = value;
        }

        private void ChangeLabel3Text(string value)
        {
            if (label3.InvokeRequired)
            {
                label3.Invoke(new Action<string>(ChangeLabel3Text), value);
                return;
            }
            label3.Text = value;
        }

        private void ChangeProgressBar1(int value)
        {
            if (progressBar1.InvokeRequired)
            {
                progressBar1.Invoke(new Action<int>(ChangeProgressBar1), value);
                return;
            }
            if(value > 100)
            {
                value = 100 / (value / 100);
            }
            progressBar1.Value = value;
        }

        private void ChangeProgressBar2(int value)
        {
            if (progressBar2.InvokeRequired)
            {
                progressBar2.Invoke(new Action<int>(ChangeProgressBar2), value);
                return;
            }
            if (value > 100)
            {
                value = 100 / (value / 100);
            }
            progressBar2.Value = value;
        }

        private void ChangeProgressBar3(int value)
        {
            if (progressBar3.InvokeRequired)
            {
                progressBar3.Invoke(new Action<int>(ChangeProgressBar3), value);
                return;
            }
            if (value > 100)
            {
                value = 100 / (value / 100);
            }
            progressBar3.Value = value;
        }

        private void SetStatus(string value)
        {
            toolStripStatusLabel1.Text = value;
        }


        .....
    }
}

As you can see, the Program simply lists serial ports, reads the selected ROM, sends 1,2,3 values to the device, measures the values, and prints them on the screen.

You can download the project files below.

Good improvements.

HTML is a programming language?

HTML as a programming language was presented to us for years. First programming language in web development was taught and is taught. But there is a point where people don’t know any. HTML is not a programming language.

HTML is a markup language. Actually HTML is a markup language XML extended through. So has been extended. It easier people web-based projects has enabled us to offer and develop people to their sites.

After it is compiled on the system works in real programming languages. Languages such as HTML or PHP is the script language completely. In no way are executed by an interpreter from compiled and interpreted. In html, the situation is different. HTML code in the browser of the DTD (Document Type Definition), XML structure are interpreted under the shed to screen it again. In this way, we can view each of them as a website.

The two are united under the roof of coding languages; compiled languages and interpreted languages that can be that can be. Languages that can be compiled; the platform on compiled byte-code form, and the generated byte-code only systems that have the same architecture employed by disassemble. In this way, the function of the actual programming language. Interpreting a text the interpreter to the user by showing the direct result.

By using the simple identifiers and document types on the screen and interprets the HTML codes of a website, there is a function to display the files or projects. For this reason, should not be regarded as a programming language.

This was present in the XML before HTML and was not so easy. Later, the W3C (Web Consortium) standards DTDS and engineers on various teams and can be understood by everyone and as a result began to develop a detectable ML (Markup Language) appeared. Currently we develop Web sites W3C’s own written HTML4/5 standards development we are doing. The main thing to be detected in the HTML, such as XML, extended. Because the origins of the first standards based on XML.

Sources: DTD on Wikipedia HTML 4 DTD HTML 5 DTD

Why am I developing a language?

It’s a story that started a few months ago.

I had the idea of writing a language with the desire to do something simpler and faster. I had many opportunities ahead of time. But I could not because of time problems. Now I have begun to develop a new language by taking advantage of the gap between them.

I decided to write the language structure. I started doing this language, taking into account the basic needs of developers. The name is “O Language”. File format is based on “.ola”. You can run simple scripts that you write. I am developing day to day languages ​​by adding a lot of extra features. Based functions; it usually came about with the simplification and simplification of what is needed. In addition, I see that most people write code on multiple lines. I think writing more functions on the line is extending 90% of people’s work. I have developed a language that has all the definitions in one line. The writing style is somewhat similar to JavaScript and C type.

Let’s write a hello world example;

 def hello = fn () {return "Hello World!" };
 hello();

To make it work;

 OlangMachine ~ $ olang hello.ola

Result;

 "Hello World!"

It’s that simple. Congratulations on your first code. We will continue with examining other sections in future periods. Stay tuned for now.

O-Language About: http://o-lang.tk