🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Showing numbers with the flashes of light

    Arduino
    1
    1
    5.3k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • DimiD
      Dimi
      last edited by

      Showing numbers with the flashes of light

      Hello! If a situation arises when it is necessary to find out the humidity and temperature, but the display is not possible to use for some reason.

      List of reasons:

      • expensive;
      • afraid of moisture;
      • too lazy to solder;
      • a small print that is not visible at all;
      • important aesthetics and minimalism;
      • all listed together.

      In this case, there is an excellent reason to use the color approach to displaying information. Everything would be fine, but the primary colors are completely worthless - some seven (from the rainbow). Can you distinguish between light blue and blue or yellow from orange? What to do? Remove such strange colors! Leave: Red, Yellow, Green, Blue, Purple and White (unexpectedly, yes?). How much did it work? 6. And there are 10 digits, and even a minus for negative numbers, a floating point and a separator. We will be smart and make a flasher! Violet - it will be 5, and six it will be 5 + 1, and 1 will be Red. Just fit. Huh! Table 1 shows the colors for the corresponding characters.

      Table 1

      Number (or char) Color (s)
      Zero blink VIOLET
      One light up RED
      Two light up YELLOW
      Three light up GREEN
      Four light up BLUE
      Five light up VIOLET
      Six blink VIOLET / RED
      Seven blink VIOLET / YELLOW
      Eight blink VIOLET / GREEN
      Nine blink VIOLET / BLUE
      Negative (-) blink WHITE / RED
      Floating point (.) blink WHITE
      Line feed (\n) light up WHITE

      Primary you need download and connect the library. Then declare a custom callback function void callback (int, int, int) R, G, B - channels (from 0 to 255), which will access the hardware (light up the LED). Call the lightf function, where the first argument will be a pointer to this same callback function, then a line with a format that is completely analogous to printf and any number of arguments. Remember to use the newline character \ n, after each qualifier in the format string.

      At my fingertips lies the Base Unit M5Stack FIRE with built-in Neopixel panels, for testing, as nothing else is better. You can watch a video demonstrating a sketch showing the Pi number with an accuracy of 6 decimal places (YouTube) here.

      Thanks!

      Download library (GitHub) here

      1 Reply Last reply Reply Quote 0
      • First post
        Last post