skills/iot/embedded-c/SKILL.md
C/C++ for embedded systems: microcontrollers, IoT, resource optimization
npx skillsauth add alphaonedev/openclaw-graph embedded-cInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill provides expertise in C/C++ programming for embedded systems, focusing on microcontrollers (e.g., Arduino, STM32) and IoT devices, emphasizing resource optimization like low memory usage and power efficiency.
Use this skill for developing firmware, handling hardware interactions (e.g., sensors, actuators), or optimizing code for constrained environments. Apply it when building IoT prototypes, debugging real-time systems, or integrating with hardware like ESP8266 for wireless connectivity.
Prompt the AI with specific, actionable requests: "Write a C function to read temperature from an LM35 sensor on an AVR microcontroller." Structure prompts to include hardware details, e.g., "For ESP32, generate code to connect to WiFi and send HTTP requests." Always specify optimization goals, like "Ensure the code uses less than 1KB of RAM." Chain prompts for iterative development: first, generate code; then, refine for bugs.
Use GCC for compilation with flags like -Os for optimization and -mmcu=atmega328p for AVR targets. For API examples:
#include <avr/io.h> for AVR microcontrollers.DDRB |= (1 << PB5); // Set PB5 as output
while(1) { PORTB ^= (1 << PB5); _delay_ms(1000); }
esp_wifi_init(&config); to initialize Wi-Fi.{"ssid": "myNetwork", "password": "$WIFI_PASSWORD"}, loaded via nvs_set_str() in ESP32 code.$AWS_IOT_KEY and access via getenv("AWS_IOT_KEY") in code.Integrate this skill with development tools by setting up environments: Install GCC and tools like avrdude for flashing. For IoT, use PlatformIO or Arduino IDE. Authenticate with services using env vars, e.g., export $AZURE_IOT_HUB_KEY for Azure integration. Link code with libraries via #pragma once guards or CMake for cross-compilation. Test on emulators like QEMU for ARM before hardware deployment. Ensure compatibility by specifying board types in prompts, e.g., "Adapt this code for STM32F4."
Always check return values in embedded code, e.g., if (i2c_read() != 0) { handle_error(); }. Use asserts for debugging: #include <assert.h> and assert(pin >= 0);. For C++, catch exceptions in main loops: try { setup_hardware(); } catch (...) { reset_device(); }. Handle hardware failures by implementing watchdogs, e.g., wdt_enable(WDTO_8S); in AVR. Log errors via UART: printf("Error: Sensor timeout\n"); and use finite state machines to recover from faults.
pinMode(2, INPUT); and in loop: if (digitalRead(2) == HIGH) { digitalWrite(13, !digitalRead(13)); delay(50); }.dht.h; use esp_http_client_init(); snippet: float temp = dht_readTemperature(); http_post_data(temp);.tools
Root web development: project structure, tooling selection, deployment decisions
development
WebAssembly: Rust/Go/C to WASM, wasm-bindgen, Emscripten, WASM Component Model
development
Vue 3: Composition API script setup, Pinia, Vue Router 4, SFCs, Vite, Nuxt 3
tools
Tailwind CSS 4: utility classes, config, JIT, arbitrary values, darkMode, plugins, shadcn/ui