Embedded · 1 min read
Hello: a blog about Embedded, AI and Robotics
The first post: introducing the blog and testing features like code, math and diagrams.
🌐 Đọc bằng tiếng ViệtHi there! This is where I document my projects and notes on embedded systems, AI and robotics.
C code highlighting
#include "stm32f4xx_hal.h"
int main(void) {
HAL_Init();
__HAL_RCC_GPIOA_CLK_ENABLE();
GPIO_InitTypeDef gpio = { .Pin = GPIO_PIN_5, .Mode = GPIO_MODE_OUTPUT_PP };
HAL_GPIO_Init(GPIOA, &gpio);
while (1) {
HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5);
HAL_Delay(500);
}
}
Math
A discrete PID controller:
Inline math: (Nyquist theorem).
Diagram
flowchart LR
S[IMU sensor] -->|I2C| M[MCU]
M -->|UART| P[Raspberry Pi]
P --> AI[AI model]
AI -->|commands| M
M --> D[Motors]
Python
import numpy as np
def moving_average(x: np.ndarray, n: int = 5) -> np.ndarray:
return np.convolve(x, np.ones(n) / n, mode="valid")