#include <FastLED.h>
#include <LEDMatrix.h>
#include <LEDText.h>
#include <FontRobotron.h>
// Change the next 6 defines to match your matrix type and size
#define LED_PIN 2
#define COLOR_ORDER RGB
#define CHIPSET WS2812B
#define MATRIX_WIDTH 16
#define MATRIX_HEIGHT 16
#define MATRIX_TYPE HORIZONTAL_ZIGZAG_MATRIX
cLEDMatrix<MATRIX_WIDTH, MATRIX_HEIGHT, MATRIX_TYPE> leds;
cLEDText ScrollingMsg;
const int xPin = A0;
unsigned char TxtDemo[] = { EFFECT_FRAME_RATE "\x03"
EFFECT_RGB "\x20\x20\x20"
EFFECT_SCROLL_LEFT " THE "
};
void setup()
{
FastLED.addLeds<CHIPSET, LED_PIN, COLOR_ORDER>(leds[0], leds.Size());
FastLED.setBrightness(32);
FastLED.clear(true);
FastLED.show();
ScrollingMsg.SetFont(RobotronFontData);
ScrollingMsg.Init(&leds, leds.Width(), ScrollingMsg.FontHeight() + 1, 1, 0);
ScrollingMsg.SetText((unsigned char *)TxtDemo, sizeof(TxtDemo) - 1);
ScrollingMsg.SetTextColrOptions(COLR_RGB | COLR_SINGLE, 0xff, 0x00, 0xff);
}
void loop()
{
if (ScrollingMsg.UpdateText() == -1)
ScrollingMsg.SetText((unsigned char *)TxtDemo, sizeof(TxtDemo) - 1);
else
FastLED.show();
delay(10);
}
Please edit your post to add code tags, and to explain the problem.
Please read the post titled "How to get the best out of the forum".
unsigned char TxtDemo[] = { EFFECT_FRAME_RATE "\x03"
EFFECT_RGB "\x20\x20\x20"
EFFECT_SCROLL_LEFT " THE "
};
What exactly is this supposed to do ?
hi everyone!!! can someone help me to put xPin value into const unsigned char TxtDemo[]
xPin has the value A0, or 14 on a Uno.
What did you have in mind?
nikitok5:
analog pin A0 value for esp32
Are you saying you want to read the analogue value on pin A0 and print that value, or you want to print the value of A0?
aarg:
Look up sprintf()
If it's an ESP32, String should be safe
TheMemberFormerlyKnownAsAWOL:
Are you saying you want to read the analogue value on pin A0 and print that value, or you want to print the value of A0?
I want to read the analogue value on pin A0 and print that value into TxtDemo
aarg:
Look up sprintf()
could u write code example how to do that please
nikitok5:
could u write code example how to do that please
Why? sprintf() has been around for about 50 years. There are tons of examples around.
aarg:
Why? sprintf() has been around for about 50 years. There are tons of examples around.
ive tried to do that like a guy from here How to store value into unsigned char array [SOLVED] - Programming Questions - Arduino Forum and i used sprintf instead of dtostrf but having problem with compilation
{drums fingers, impatiently}
system
Closed
15
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.