GithubHelp home page GithubHelp logo

hidan0 / led-brightness-pwm Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 39 KB

[ESP32C3] Control LED brightness via PWM in Rust!

License: MIT License

Rust 42.02% HTML 2.58% Vue 49.61% SCSS 3.20% TypeScript 2.59%

led-brightness-pwm's Introduction

Led Brightness PWM

Description

This project demonstrates how to use an ESP32C3 to control the brightness of an LED remotely via a Wi-Fi network. The brightness of the LED is controlled via Pulse Width Modulation (PWM).

This project incorporates a web application built with Vue.js to facilitate LED brightness adjustment.

Demo

Overview

LED Control

The led controller can be found under led-brightness/.

First of all you need to set wifi_ssid and wifi_pwd, to do so create a copy of cfg.toml.example and rename it to cfg.toml, then set your Wi-Fi data.

# cfg.toml.example
[led-brightness]
wifi_ssid = "FBI Surveillance Van"
wifi_pwd = "hunter2"

The web server exposes the following endpoints:

  • GET: /brightness returns:

    {
        "max": "<max duty>",
        "current": "<current duty>"
    }
  • PUT: /brightness?<val> where: $0 \leq$ val $\leq 100$ used to set LED brightness

  • OPTIONS: /brightness used for CORS

The PWM is set to Gpio6.

Web app

The web app can be found under slider/.

To run it you need to:

  • Install dependences:

    $ yarn install
  • Set BOARD_IP in ./src/components/Slider.vue with the IP shown in the logs;

  • Start the app:

    $ yarn dev

    or

    $ yarn dev --host

    to use it remotely (must be under same Wi-Fi network).

led-brightness-pwm's People

Contributors

hidan0 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.