{"id":19832029,"url":"https://github.com/danielmartensson/c-applications","last_synced_at":"2025-09-18T09:31:51.125Z","repository":{"id":120604012,"uuid":"164336218","full_name":"DanielMartensson/C-Applications","owner":"DanielMartensson","description":"Embedded C with ST Microelectronics CubeMX and other C-applications","archived":false,"fork":false,"pushed_at":"2019-08-05T13:36:06.000Z","size":9129,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-12T11:42:51.559Z","etag":null,"topics":["atollic","c","cubemx","eclipse-cdt","embedded","stm32","truestudio"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DanielMartensson.png","metadata":{"files":{"readme":"ReadMe.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2019-01-06T18:56:11.000Z","updated_at":"2024-10-17T07:20:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"d042b93d-fd96-478b-96bc-713645ae1874","html_url":"https://github.com/DanielMartensson/C-Applications","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielMartensson%2FC-Applications","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielMartensson%2FC-Applications/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielMartensson%2FC-Applications/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielMartensson%2FC-Applications/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DanielMartensson","download_url":"https://codeload.github.com/DanielMartensson/C-Applications/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233466586,"owners_count":18680564,"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":["atollic","c","cubemx","eclipse-cdt","embedded","stm32","truestudio"],"created_at":"2024-11-12T11:36:05.342Z","updated_at":"2025-09-18T09:31:44.156Z","avatar_url":"https://github.com/DanielMartensson.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# What is this?\n\nThis is a collection project, like my other projects. In this project repository, I use the C programming language, Atollic TrueSTUDIO and CubeMX to program a STM32 microcontroller and Eclipse CTD to create C-applications for desktop. I normaly use Java for embedded too, but only for IoT. When it comes to requriments of speed for control systems or communications, C is the only choice.\n\n# USB IO\nThis is a example project how to control three PWM outputs, PA8, PA9 and PA10, and read analog values from PA0, PA1 and P4 \nwith a 12-bit ADC. The PWM has a period of 1 second and the PWM is configured as 8-bit.\n\nThe ADC sends back a string of the adc values \"'PA0','PA1','PA4'\\r\\n\", (without ' and \") with baudrate 115200 all the time. \nThe PWM want to have a word of 8-bit, for example \"AAA\" or \"A@\u0026\" or \"A=ÿ\", where the first symbol is the 8-bit ASCII character \nfor PA8, the second symbol is PA9 and the last symbol is for PA10. The symbol ÿ will give 100% duty call because ÿ is ASCII 255.\n\n![](https://github.com/DanielMartensson/C-Applications/blob/master/USB-IO/USB-IO-STM32.jpg?raw=true)\n\nHere is an example how to send those ASCII numbers to the USB-IO. \n\n![](https://github.com/DanielMartensson/C-Applications/blob/master/USB-IO/USB-IO.png?raw=true)\n\n# Bluetooth Blue Giga API - GBLib\nThis is a working example how to use the BLExxxx modules such as BLED112 USB Bluetooth Dongle. Fully portable for both Windows and Linux.\nWritten in pure C code and is terminal based. In Linux, you must be root to access this BLExxxx module from the serial port.\n\nThis example is built on current example from Silicon Labs, but I have extended it with a chat function by writing some few lines of code.\n\n![](https://raw.githubusercontent.com/DanielMartensson/C-Applications/master/Bluetooth%20Blue%20Giga%20API/index.jpeg?raw=true)\n\n\n## How to use\nFlash the BLE module with the hex file located in the \"ubdcdc\" folder from the \"Bluetooth Blue Giga API\" folder. Then you need to use the BlueGiga GUI and from the menu -\u003e \ncommand -\u003e DFU. There you will burn the hex into your BLExxxx module. \n\nOnce your have done that, you shall open the \"BLED112\" folder from the \"Bluetooth Blue Giga API\" folder. It's a Eclipse project. Best way is to install Eclipse CDT \nand import the project: File -\u003e Import... -\u003e General -\u003e Existing Projects into Workspace. \n\nCompile the project and then run it and write in your COM port in Windows or your dev-port in Linux.\n\nExample:\n```\n\t\t\tBLED112 for Windows and Linux using MinGW/GCC - Using BlueGiga API\t\t\t\nWhat do you want to do?:\n1. Scan all the peripheral BLE devices MAC addresses around you: \n2. Connect a peripheral BLE device and start talking to it: \n3. Info about the connected BLED112 device in your COM port: \n4. Talk to a master BLED device from your peripheral BLED device: \nSelect a number: 2\nEnter COM port e.g /dev/ttyXXXX or COMx: /dev/ttyACM1\nSelected COM port is: /dev/ttyACM1\nEnter 6 hex MAC address e.g ´hex:hex:hex:hex:hex:hex´: 88:6b:0f:b2:77:9c\nSelected MAC address is: 88:6b:0f:b2:77:9c\nSUCCESS: Open serial port: /dev/ttyACM1\nConnecting to peripheral...\nWhat do you want to do?\n1. Write string of length at maximum 20 bytes.\n2. Read incomming message.\n3. Abort.\nAny number just update any message.\nEnter: 1\nEnter text: HELLO!\nWhat do you want to do?\n1. Write string of length at maximum 20 bytes.\n2. Read incomming message.\n3. Abort.\nAny number just update any message.\nEnter: A\nConnection lost.\nReason: User on the remote device terminated the connection. Code[213]\nWhat do you want to do?\n1. Write string of length at maximum 20 bytes.\n2. Read incomming message.\n3. Abort.\nAny number just update any message.\nEnter: \n```\n\n# PWM controlling a hydraulic haning load\nThis project is done by turning a potentiometer (10K) so an embedded system (STM32) can read the analog signals. The embedded system then send out a PWM frequency in high Hz so it will control a spole at hydraulic propotional valve. The valve will there fore release a velocity of oil to the hydraulic cylinder and then build a pressure due to the mass as load. The variable orifice is a shunt so the valve can operate the position on the mass. Else, it will be a very static system. Even if this is possible to control, it's still very nonlinear and I tried a Model Predictive Control system where the output of the state space model was velocity. But it was very hard to control.\n\nI therefore will focusing on Fuzzy-Logic for hydraulical systems.\n\nPlease watch the video inside the folder \"Potentiometer To PWM Generator\" so you can see how it looks like when I turn the potentiometer and the load goes up and down.\n\n![](https://raw.githubusercontent.com/DanielMartensson/C-Applications/master/Potentiometer%20To%20PWM%20Generator/Bench.jpeg?raw=true)\n\n![](https://raw.githubusercontent.com/DanielMartensson/C-Applications/master/Potentiometer%20To%20PWM%20Generator/Schematic.png?raw=true)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielmartensson%2Fc-applications","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielmartensson%2Fc-applications","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielmartensson%2Fc-applications/lists"}