Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 10, 2016, 05:53:29 05:53


Login with username, password and session length


Pages: [1]
Print
Author Topic: The simplest indicator of the audio signal  (Read 1292 times)
0 Members and 1 Guest are viewing this topic.
Catcatcat
Active Member
***
 Warned
Offline Offline

Posts: 117

Thank You
-Given: 89
-Receive: 258



WWW
« on: December 18, 2013, 06:23:15 18:23 »

Simple VU-meter with LEDs with integrated driver WS2812B




demo video
http://youtu.be/a_l2giyGSZQ

The project used a controller PIC12F1822. The project was implemented in MPLAB X IDE v1.95, the compiler Microchip MPLAB XC8 C Compiler V1.21

More details can be found on my website http://catcatcat.d-lan.dp.ua/samyiy-prostoy-indikator-urovnya-zvukovogo-signala/

I hope this project will be of interest/

project in the attachment
« Last Edit: December 19, 2013, 08:43:53 20:43 by metal » Logged
Curious
Inactive

Offline Offline

Posts: 1

Thank You
-Given: 5
-Receive: 0


« Reply #1 on: October 26, 2015, 02:18:32 02:18 »

Interesting project. I love WS2812 LEDs.

The code you use to encode the pattern to program the WS2812 could be simplified a lot if you simply used a bit mask variable instead of doing a hardcoded binary test of every combination.

Instead, do something like:

Code:
unsigned char m;
for(....)
    ...
    m = 0b10000000;
    do {
        if ((temp & m) == m) {
            // code for outputting 1 to WS2812
        } else {
            // code for outputting 0 to WS2812
        }
        // shift the bitmask to the right
        // after shifting 8 times, m will be 0
        m >>= 1; 
    } while (m > 0);
    ....
}

This will result in much small code and it will also be a lot more efficient since you only need to test the mask once (in your code, you test it 8 times for each loop).

Hope this helps.
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC