{"id":22938473,"url":"https://github.com/aasmundn/robot-car","last_synced_at":"2026-05-01T15:31:22.587Z","repository":{"id":188044924,"uuid":"678013223","full_name":"AasmundN/robot-car","owner":"AasmundN","description":"ESP32 code template and library for NTNU start week, fall 2023.","archived":false,"fork":false,"pushed_at":"2023-08-21T13:05:02.000Z","size":606,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-01T19:42:32.758Z","etag":null,"topics":["arduino","esp32","ntnu","zumo32u4"],"latest_commit_sha":null,"homepage":"","language":"HTML","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/AasmundN.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-08-13T12:01:31.000Z","updated_at":"2025-02-12T09:36:56.000Z","dependencies_parsed_at":"2023-08-13T13:39:39.324Z","dependency_job_id":"513a66c1-962d-4b65-b674-1ba766a46b9d","html_url":"https://github.com/AasmundN/robot-car","commit_stats":null,"previous_names":["aasmundn/robot-car"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AasmundN/robot-car","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AasmundN%2Frobot-car","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AasmundN%2Frobot-car/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AasmundN%2Frobot-car/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AasmundN%2Frobot-car/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AasmundN","download_url":"https://codeload.github.com/AasmundN/robot-car/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AasmundN%2Frobot-car/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32502935,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["arduino","esp32","ntnu","zumo32u4"],"created_at":"2024-12-14T12:18:08.701Z","updated_at":"2026-05-01T15:31:22.566Z","avatar_url":"https://github.com/AasmundN.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"![JavaScript](https://img.shields.io/static/v1?style=flat\u0026message=JavaScript\u0026color=373e47\u0026logo=JavaScript\u0026logoColor=F7DF1E\u0026label=)\n![Firebase](https://img.shields.io/static/v1?style=flat\u0026message=Arduino\u0026color=373e47\u0026logo=Arduino\u0026logoColor=00979C\u0026label=)\n\n\u003cp align=\"center\"\u003e\n  \u003cimg height=\"100\" src=\"/img/car.png\" /\u003e\n\u003c/p\u003e\n\n## Installation\n\n### ESP32 setup\n\nIn the _Arduino IDE_ choose the _ESP32 Dev Module_ board. Paste the [carLibrary](carLibrary/) directory into your arduino library folder. Then install the following libraries and their dependencies via the library manager in the IDE.\n\n-  AsyncTCP\n\nLastly install the [ESPAsyncWebServer](https://github.com/me-no-dev/ESPAsyncWebServer#installation) library as a _.ZIP_ file from github and include it in the IDE.\n\n### Zumo34U4 setup\n\nSelect _Arduino Leonardo_ as the board and download the following library and its dependencies using the library manager.\n\n-  Zumo32U4\n\n## Features\n\n### Setup\n\nThe `carLibrary` exposes a class named `Car`. Its constructor accepts a network name and password.\n\n```cpp\nCar car(\"networkName\", \"networkPassword\");\n```\n\nIn the program setup call the member function `initCar`.\n\n```cpp\nvoid setup() {\n   car.initCar();\n}\n```\n\n### Buttons and driving\n\nThe `carLibrary` exposes nine void functions named `w`, `a`, `s`, `d`. `e`, `q`, `triangle`, `circle` and `square`. These are called when the corresponding buttons on the control panel are pressed, and released. They all accept a parameter `bool button` indicating whether the button is pressed down or released. The defined helpers `UP` and `DOWN` can be used to check the button direction.\n\n```cpp\nvoid w(bool button) {\n   if (button == UP) {\n      // button is released\n   } else if (button == DOWN) {\n      // button is pressed\n   }\n}\n```\n\nTo drive the car use the member function `drive`. This takes two arguments representing the speed of the left and right belt. These arguments are integers ranging from `-100` to `100`.\n\n```cpp\n// drive forward max speed\ncar.drive(100,100);\n\n// stop car\ncar.drive(0,0);\n\n// sharp turn left at half speed\ncar.drive(-50, 50);\n```\n\n\u003e Driving with low speeds can be harmful to the motors. A `MOTOR_LOWER_LIMIT` has therefor been placed at _30_. Trying to drive with speeds under this limit will result in the car stopping.\n\n### Sensor data\n\nSensor data can be fetched through the `data` array on the _Car_ class. Each data point contains a `value` and `flag`. All data values are integers and are updated roughly **20 times per second**. Whenever a data value is updated the data flag is set to true.\n\n```cpp\n// reading data continously\nint proxData = car.data[PROXIMITY].value;\n\n// read data when it is available\nif (car.data[PROXIMITY].flag) {\n   int proxData = car.data[PROXIMITY].value;\n   car.data[PROXIMITY].flag = false;\n}\n```\n\nThe available data can be fetched using the defined helpers.\n| Data | Range | Details |\n|----- | :-----: | ----- |\n| PROXIMITY | 0 \u0026rarr; 12 | The closer the object the higher the value. |\n| LINE | -100 \u0026rarr; 100 | When the line is to the right of the car the number is positive. |\n| ENCODERS | **n/a** | Encoder counts 12 times per motor rotation. |\n| READ_TIME | **n/a** | Time corresponding to one encoder reading in _ms_. |\n| GYRO | -180 \u0026rarr; 180 | Car angle along the _z_ axis. |\n\n\u003e **_Motor rotations:_** Because of the 75:1 gear ratio in the motor every 75th motor rotation corresponds to one rotation of the wheel.\n\n**Calibrating**\n\n-  To calibrate the gyroscope use the member function `calibrateGyro`. This accepts an unsigned integer indicating the precision of the calibration. This value may typically be in the range of _1024_ to _4096_, although a higher number leads to better precision. **The car must be completely still when calibrating**. The buzzer will sound when calibration is done.\n\n```cpp\n// calibrate gyro with 2048 as precision\ncar.calibrateGyro(2048);\n```\n\n-  To calibrate the line sensors use the member function `calibrateLine`. This accepts a helper `BLACK` or `WHITE` indicating whether the car should read a dark line on a light background or the opposite. **The car must be placed on a line when calibrating**. The buzzer will sound when calibration is done.\n\n```cpp\n// follow dark line\ncar.calibrateLine(BLACK);\n```\n\n### Graphing data\n\nThe control panel can graph three seperate data streams. The member function `sendData` accepts two arguments; an int specifying the graph and the data to send.\n\n```cpp\n// send gyroscope data to graph 1\ncar.sendData(1, car.data[GYRO].value);\n\n// send variable speed to graph 3\ncar.sendData(3, speed);\n```\n\nTo send continous data call the function in the program loop. The function will update the graph data roughly **10 times per second**.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faasmundn%2Frobot-car","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faasmundn%2Frobot-car","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faasmundn%2Frobot-car/lists"}