ledstrip_remote - wolfen351/public-micropython-iot-platform GitHub Wiki

Overview

This module displays a virtual LED strip remote on a touchscreen and handles user interactions through touch inputs. It allows users to control the brightness, color, and effects of an LED strip.

Features

  • Touchscreen-based LED strip remote interface.
  • Adjustable brightness (0-100%).
  • Color selection from a predefined palette.
  • Support for effects like strobe, fade, and smooth (to be implemented).

UI Hardware / Pinout Configuration

  • Touchscreen Display: 320x240 resolution.
  • SPI Configuration:
    • High-speed SPI for drawing: baudrate=40000000.
    • Low-speed SPI for touch: baudrate=2000000.
    • Pins:
      • sck=Pin(7)
      • mosi=Pin(11)
      • miso=Pin(9)
      • dc=Pin(12)
      • cs=Pin(5)
      • rst=Pin(0)
      • Touch chip select: cs=Pin(18).

This image is displayed to the user: Remote Image

Telemetry Provided

  • colorRGB: Current RGB color in the format R,G,B.
  • brightness: Current brightness level (0-100).

Telemetry Consumed

None.

Commands Provided

  • Brightness adjustment (increase, decrease, on, off).
  • Color selection (red, green, blue, white, and additional colors).
  • Effects (strobe, fade, smooth).

Examples of Commands Sent

  1. Color Selection:

    • If the user presses the "Blue" button, the following command is sent:
      {
        "command": "setColor",
        "value": "0,0,255"
      }
      
  2. Brightness Adjustment:

    • If the user increases brightness, the following command is sent:
      {
        "command": "setBrightness",
        "value": 51
      }
      
      (Assuming the brightness was previously at 50 and increased by 1.)
    • If the user decreases brightness, the following command is sent:
      {
        "command": "setBrightness",
        "value": 49
      }
      
      (Assuming the brightness was previously at 50 and decreased by 1.)
    • If the user presses "Off", the following command is sent:
      {
        "command": "setBrightness",
        "value": 0
      }
      
    • If the user presses "On", the following command is sent:
      {
        "command": "setBrightness",
        "value": 100
      }
      
  3. Effects:

    • If the user presses "Strobe", "Fade", or "Smooth", placeholder commands are sent (to be implemented):
      {
        "command": "setEffect",
        "value": "strobe"
      }
      
      {
        "command": "setEffect",
        "value": "fade"
      }
      
      {
        "command": "setEffect",
        "value": "smooth"
      }
      

Commands Consumed

None.

Additional Information

  • The module uses the color565 function to convert RGB values to 16-bit color format for the display.
  • Touch inputs are mapped to specific rows and columns on the touchscreen to determine the selected button.
  • Effects like strobe, fade, and smooth are placeholders and need further implementation.