{"id":23219602,"url":"https://github.com/mk590901/toit-temperature-sensor","last_synced_at":"2025-08-31T17:46:05.545Z","repository":{"id":207956014,"uuid":"720496679","full_name":"mk590901/toit-temperature-sensor","owner":"mk590901","description":"The repository contains an implementation of a temperature sensor simulator in the TOIT language for ESP32 controller.","archived":false,"fork":false,"pushed_at":"2023-11-22T19:18:41.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-11T11:52:57.661Z","etag":null,"topics":["esp32","toit-language","toitware"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mk590901.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-18T17:03:04.000Z","updated_at":"2023-11-21T18:12:12.000Z","dependencies_parsed_at":"2024-12-18T21:36:07.311Z","dependency_job_id":"70e46c5c-554b-44a2-bd92-05a082c228f6","html_url":"https://github.com/mk590901/toit-temperature-sensor","commit_stats":null,"previous_names":["mk590901/temperature-sensor","mk590901/toit-temperature-sensor"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mk590901%2Ftoit-temperature-sensor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mk590901%2Ftoit-temperature-sensor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mk590901%2Ftoit-temperature-sensor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mk590901%2Ftoit-temperature-sensor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mk590901","download_url":"https://codeload.github.com/mk590901/toit-temperature-sensor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247353742,"owners_count":20925329,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["esp32","toit-language","toitware"],"created_at":"2024-12-18T21:36:01.268Z","updated_at":"2025-04-05T15:12:01.004Z","avatar_url":"https://github.com/mk590901.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# TOIT Temperature Sensor Simulator\n\n## Introduction\n\nThe project consists of two applications: server and client apps.\n\n## Server\n\nThe server is a temperature sensor emulator. It's described by a state machine that responds to event *start*. The measurement process takes two seconds after which the sensor produces a random value in the range from 24°C to 42°C. The values are generated in a certain predefined order, giving the appearance of a gradual temperature change. If event *start* occurs during a measure, the the measurement is stopped and sensor returns the value *cancel*. The server also handles the *exit* event, closing the task that is processing the input message stream. Pay attention to the **Task** class (task.toit) simulated *thread*.\n\n## Client\n\nThe client is a separate application that sends commands to the server to start the measurement or interrupt it, depending on the delay between sendings. Having completed its work, the client closes the task of incoming measurement results messages and sends an exit signal, stopping the server.\n\n## Run apps\n\nThe client and server run separately. Each app launches from their own terminal window. The server starts first, then the client as shown in movie. There are 3 ways to do it:\n\n\u003e On the same chip, using cloud topics. Strange as it may seem, toitware has implemented the ability to run several independent applications in parallel on one chip. In this case, both the server and the client are running on a controller called **nuc**:\n\n- $ toit run -d=nuc cloud_task_server.toit\n- $ toit run -d=nuc cloud_task_client.toit\n\n\u003e On different chips. You should simply specify the names of the ESP32 chips when starting the server and client. In this case, the server is launched on the **nuc** controller, the client - on the **mini** controller.\n\n- $ toit run -d=nuc cloud_task_server.toit\n- $ toit run -d=mini cloud_task_client.toit\n\n\u003e If you slightly change the application by replacing the topics in files **cloud_task_server.toit**, **cloud_task_client**, and **outer_pubsub.toit**: \"cloud:demo/ping\" to \"device:demo/ping\" and \"cloud:demo/pоng\" to \"device:demo/pоng\", you'll get server and client that exchange data inside one chip without  data messaging via the internet:\n\n- $ toit run -d=nuc cloud_task_server.toit\n- $ toit run -d=nuc cloud_task_client.toit\n\n\u003e File *trace_run_client_server.txt* contains the output printed on terminals for cases 1 and 2. The prefix **\u003c\u003c** is the data that the application receives, and the prefix **\u003e\u003e** corresponds to the data that the application sends to its account partner via the *internet*.\n\n# Movie\n\nhttps://github.com/mk590901/temperature-sensor/assets/125393245/e7c1d652-9be1-48b5-9170-9e9cdd7e604c\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmk590901%2Ftoit-temperature-sensor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmk590901%2Ftoit-temperature-sensor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmk590901%2Ftoit-temperature-sensor/lists"}