-
-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not Library related #56
Comments
Hello, Part 1 of your question. I'm surprised Part 2: yeah they are very limited for space ok! I have a scrolling text example on the Trinity Github repo that should hopefully help it should be simple enough to modify this to use spotify inside your spotify callback just update the text variable and reset it's position
A couple of thoughts around this:
|
Thank you very much for your advice. I apologize because I am very new to programming and it is difficult for me to make changes that do not result in compilation errors. |
The error is: currentlyPlaying' was not declared in this scope , when i try to put on both setup or loop part of the code. However, dma_display->print(currentlyPlaying.trackName); seens to work OK in the Void Setup part, but no on the loop part. So, i think i need those funtions working on the loop part in order to integrate with your Trinity - scroll skecht (that works like a charm) |
This is the close i can get: Where cursor seens to be scrolling as expected, i can only draw 1 time track name every spotify callback, so i put 1 second between calls. really laggy result this way. `// ---------------------------- #if defined(ESP8266) #include <Arduino.h> #include "Fonts/FreeSansBold9pt7b.h" #include <WiFiClientSecure.h> #include <SpotifyArduino.h> // Install from Github // including a "spotify_server_cert" variable #include <ArduinoJson.h> // Search for "Arduino Json" in the Arduino Library manager //------- Replace the following! ------ char ssid[] = "MiFibra-XXXX"; // your network SSID (name) // Country code, including this is advisable #define SPOTIFY_REFRESH_TOKEN bxEyrT4p8fXXXXXXXXXXXXXXXXXXXXXXXXZKpbaO4" //------- ---------------------- ------ const int panelResX = 64; // Number of pixels wide of each INDIVIDUAL panel module. #define ENABLE_DOUBLE_BUFFER 1 // This is a good example to show the difference the //estaba quitado originalmente // See the "displaySetup" method for more display config options //------------------------------------------------------------------------------------------------------------------ MatrixPanel_I2S_DMA *dma_display = nullptr; // For scrolling Text int textXPosition = panelResX * panel_chain; // Will start off screen String text = "ESP32 Trinity, by Brian Lough"; WiFiClientSecure secured_client; uint16_t myBLACK = dma_display->color565(0, 0, 0); void displaySetup() { #ifdef ENABLE_DOUBLE_BUFFER mxconfig.clkphase = false; dma_display = new MatrixPanel_I2S_DMA(mxconfig); TaskHandle_t Task1; WiFiClientSecure client; unsigned long delayBetweenRequests = 1000; // Time between requests (1 minute) void setup() Serial.begin(115200); dma_display->fillScreen(myBLACK); #endif WiFi.mode(WIFI_STA); // Wait for connection // Handle HTTPS Verification Serial.println("Refreshing Access Tokens"); void printCurrentlyPlayingToSerial(CurrentlyPlaying currentlyPlaying) dma_display->fillScreen(myBLACK); Serial.println("Artist: "); // Will be used in getTextBounds. void loop() unsigned long now = millis();
// dma_display->print(text); #ifdef ENABLE_DOUBLE_BUFFER } #ifdef ENABLE_DOUBLE_BUFFER
// int status = spotify.getCurrentlyPlaying(printCurrentlyPlayingToSerial, SPOTIFY_MARKET); |
Hi Brian, first thank you for your work.
I have implemented your Spotify api in order to show current track name and artist on a rgb matrix display (single 64x32 module with esp32 hub75 / Mrfaptastic library ).
Although in principle it works correctly, I can't show the name of the artist with dma_display->print(currentlyPlaying.artists[i].artistName);
I get compiling error with this funtion on RGB matrix display (on serial monitor is just fine)ç
Another help that I would like to ask you, is if it is possible to make the text scroll since there is not space for so much information in a simple panel.
Thanks in advance
`// ----------------------------
// Standard Libraries
// ----------------------------
#if defined(ESP8266)
#include <ESP8266WiFi.h>
#elif defined(ESP32)
#include <WiFi.h>
#endif
#include <Adafruit_GFX.h>
#include <Adafruit_GrayOLED.h>
#include <Adafruit_SPITFT.h>
#include <Adafruit_SPITFT_Macros.h>
#include <gfxfont.h>
#include <Arduino.h>
#include "Fonts/FreeSansBold9pt7b.h"
#include "Fonts/FreeSansBold12pt7b.h"
#include "Fonts/FreeSansBold18pt7b.h"
#include "Fonts/Picopixel.h"
#include "Fonts/FreeSerif9pt7b.h"
#include "Fonts/FreeSerif12pt7b.h"
#include "Fonts/FreeSerif18pt7b.h"
//#include "Fonts/FreeSerif12pt7b.h"
#include <WiFiClientSecure.h>
#include <ESP32-HUB75-MatrixPanel-I2S-DMA.h>
// ----------------------------
// Additional Libraries - each one of these will need to be installed.
// ----------------------------
#include <SpotifyArduino.h>
// Library for connecting to the Spotify API
// Install from Github
// https://github.com/witnessmenow/spotify-api-arduino
// including a "spotify_server_cert" variable
// header is included as part of the SpotifyArduino libary
#include <SpotifyArduinoCert.h>
#include <ArduinoJson.h>
// Library used for parsing Json from the API responses
// Search for "Arduino Json" in the Arduino Library manager
// https://github.com/bblanchon/ArduinoJson
//------- Replace the following! ------
char ssid[] = "MiFibra-XXXX"; // your network SSID (name)
char password[] = "XXXXXXX"; // your network password
char clientId[] = "XXXXXXXXXXXXXXXXXXXXXXXXXXXX"; // Your client ID of your spotify APP
char clientSecret[] = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; // Your client Secret of your spotify APP (Do Not share this!)
// Country code, including this is advisable
#define SPOTIFY_MARKET "IE"
#define SPOTIFY_REFRESH_TOKEN "AQBn5xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx--D4oPfCCMaXZAnQqBcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxaO4"
//------- ---------------------- ------
// -------------------------------------
// ------- Matrix Config ------
// -------------------------------------
const int panelResX = 64; // Number of pixels wide of each INDIVIDUAL panel module.
const int panelResY = 32; // Number of pixels tall of each INDIVIDUAL panel module.
const int panel_chain = 1; // Total number of panels chained one to another
#define ENABLE_DOUBLE_BUFFER 1 // This is a good example to show the difference the //estaba quitado originalmente
// double buffer makes, it doesn't flash as much
// comment this out to test without it
// See the "displaySetup" method for more display config options
//------------------------------------------------------------------------------------------------------------------
MatrixPanel_I2S_DMA *dma_display = nullptr;
WiFiClientSecure secured_client;
uint16_t myBLACK = dma_display->color565(0, 0, 0);
uint16_t myWHITE = dma_display->color565(255, 255, 255);
uint16_t myRED = dma_display->color565(255, 0, 0);
uint16_t myGREEN = dma_display->color565(0, 255, 0);
uint16_t myBLUE = dma_display->color565(0, 0, 255);
uint16_t myPINK = dma_display->color565(227, 28, 121);
uint16_t myYELLOW = dma_display->color565(255, 255, 0);
uint16_t myPURPLE = dma_display->color565(199, 36, 177);
void displaySetup() {
HUB75_I2S_CFG mxconfig(
panelResX, // module width
panelResY, // module height
panel_chain // Chain length
);
#ifdef ENABLE_DOUBLE_BUFFER
// This is how you enable the double buffer.
// Double buffer can help with animation heavy projects
mxconfig.double_buff = false;
#endif
mxconfig.clkphase = false;
dma_display = new MatrixPanel_I2S_DMA(mxconfig);
dma_display->begin();
}
TaskHandle_t Task1;
WiFiClientSecure client;
SpotifyArduino spotify(client, clientId, clientSecret, SPOTIFY_REFRESH_TOKEN);
unsigned long delayBetweenRequests = 6000; // Time between requests (1 minute)
unsigned long requestDueTime; //time when request due
void setup()
{
displaySetup();
dma_display->fillScreen(myBLACK);
dma_display->setFont(&FreeSansBold9pt7b);
dma_display->setCursor(0,20);
dma_display->setTextSize(1); // size 2 == 16 pixels high
dma_display->setTextWrap(false); // N.B!! Don't wrap at end of line
dma_display->setTextColor(myWHITE);
#ifdef ENABLE_DOUBLE_BUFFER
dma_display->flipDMABuffer();
#endif
#if defined(ESP8266)
client.setFingerprint(SPOTIFY_FINGERPRINT); // These expire every few months
#elif defined(ESP32)
client.setCACert(spotify_server_cert);
#endif
}
void printCurrentlyPlayingToSerial(CurrentlyPlaying currentlyPlaying)
{
Serial.print("Track: ");
Serial.println(currentlyPlaying.trackName);
}
void loop()
{
#ifdef ENABLE_DOUBLE_BUFFER
dma_display->flipDMABuffer();
#endif
if (millis() > requestDueTime)
{
}`
The text was updated successfully, but these errors were encountered: