majicdesigns / chroniker Goto Github PK
View Code? Open in Web Editor NEWA LED Neopixel Analog Clock with multiple control interfaces (Bluetooth, IR Remote, tact switch)
A LED Neopixel Analog Clock with multiple control interfaces (Bluetooth, IR Remote, tact switch)
Hi, I'm about to run your project with HC-06 (ZS040 version) Bluetooth module, connected to Serial2 pin (16 and 17).
I've selected the #define for HC-06 and enabled serial debug. However serial monitor show the following error:
[Chroniker Clock Debug]
Start BT connection at 9600
BT err on NAME:
Setup exit, free mem 7058
RUN_INIT
RUN_NORMAL
In the smartphone, the APP show "Connected" but every command answer is "0: Timeout [Rcv]".
As written in the following tutorial:
http://www.martyncurrey.com/hc-06-hc01-comv2-0/
I've tried to update the following line in Chroniker_BT.h file:
from const char *szEnd = "\r\n";
to const char *szEnd = "";
But the problem is the same.
I had no problem with same Arduino hardware and same HC-06 module but with simpler firmware.
Do you have any idea?
Thanks
I am trying to learn off this project how to work with interrupts to switch patterns during a pattern loop using "millis" statements. I am assuming these are "state machines"?
I am trying to replace one of the case statements (demo pattern 2) to use the "BouncingColoredBalls" pattern in place of i.e "demoRainbowWithGlitter". This pattern usually runs for infinity and wanted to see if I could get it to switch using the interrupts you have in place.
I am having trouble understanding the "(bool bInit)" portion of "void demoRainbowWithGlitter(bool bInit)". I am assuming it is calling something in FastLED library and may need to implement it somehow?
The "BouncingColoredBalls" pattern is found here:
https://www.tweaking4all.com/forums/topic/bouncy-ball-effect/
https://www.tweaking4all.com/hardware/arduino/adruino-led-strip-effects/
I am also trying to figure out how to tweak "BouncingColoredBalls" to work with your sketch.
i.e. Case 2 calling:
(built in tool did not format correctly)
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
case 0: demoCylon(newDemo); newDemo = false; break;
case 1: demoRainbow(newDemo); newDemo = false; break;
// case 2: demoRainbowWithGlitter(newDemo); newDemo = false; break;
case 2: byte bbcolors[5][3] = { {0xff, 0,0}, // red
{0, 0xff, 0}, // green
{0, 0, 0xff}, // blue
{0xff, 0xff, 0xff},// white
{0xff, 0xff, 0} }; // yellow
BouncingColoredBalls(5, bbcolors);(newDemo); newDemo = false; break;
case 3: demoConfetti(newDemo); newDemo = false; break;
case 4: demoSinelon(newDemo); newDemo = false; break;
case 5: demoBPM(newDemo); newDemo = false; break;
case 6: demoJuggle(newDemo); newDemo = false; break;
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I am probably way off :-). I dont think it falls in the correct syntax as you have laid out. Also looking at other examples, I see you did restructure a few things such as in the Cylon pattern, defining case1/case2. I am wondering how much I have to tweak, i.e change "show.pixel" to " FastLED.show();" etc. I am relatively new to programming and any assistance is greatly appreciated!
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
void BouncingColoredBalls(int BallCount, byte colors[][3])
{
if (bInit) initDemo();
if (millis() - timeStart < ANIMATION_DELAY)
return;
timeStart = millis();
float Gravity = -9.81;
int StartHeight = 1;
float Height[BallCount];
float ImpactVelocityStart = sqrt( -2 * Gravity * StartHeight );
float ImpactVelocity[BallCount];
float TimeSinceLastBounce[BallCount];
int Position[BallCount];
long ClockTimeSinceLastBounce[BallCount];
float Dampening[BallCount];
for (int i = 0 ; i < BallCount ; i++) {
ClockTimeSinceLastBounce[i] = millis();
Height[i] = StartHeight;
Position[i] = 0;
ImpactVelocity[i] = ImpactVelocityStart;
TimeSinceLastBounce[i] = 0;
Dampening[i] = 0.90 - float(i)/pow(BallCount,2);
}
while (true) {
for (int i = 0 ; i < BallCount ; i++) {
TimeSinceLastBounce[i] = millis() - ClockTimeSinceLastBounce[i];
Height[i] = 0.5 * Gravity * pow( TimeSinceLastBounce[i]/1000 , 2.0 ) + ImpactVelocity[i] * TimeSinceLastBounce[i]/1000;
if ( Height[i] < 0 ) {
Height[i] = 0;
ImpactVelocity[i] = Dampening[i] * ImpactVelocity[i];
ClockTimeSinceLastBounce[i] = millis();
if ( ImpactVelocity[i] < 0.01 ) {
ImpactVelocity[i] = ImpactVelocityStart;
}
}
Position[i] = round( Height[i] * (NUM_LEDS - 1) / StartHeight);
}
for (int i = 0 ; i < BallCount ; i++) {
setPixel(Position[i],colors[i][0],colors[i][1],colors[i][2]);
}
showpixel();
setAll(0,0,0);
}
}
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.