Marco,
Thanks again for your reply and I fully agree that using Zones would be the best way forward and I intend to adopt the Parola Library and the zones technique in future projects as I can see it would be a lot more versatile.
Unfortunately at this point it would take a lot of Hardware and wiring changes, to re-arrange everything into One big String of Matracies with one connection to the Arduino.
For this project which now has very tight time constraints, I have simplified the design somewhat and added a separate set of 4 MAX7219 Modules, as a separate display for the secret code that is to be displayed when the game is solved.
I have made a lot of progress with the project now that I am not trying to rotate any of the text or use the same displays for the secret code as I am using for the Bar-graphs.
The only issue i have now, as you can see from the attached photographs is that when the game is solved, I can't seem to change the text on the Code Display (Lines 103 and 104) from "? ? ? ?" to the secret code "6 C 3 A".
I borrowed some code from your MD_MAX72xx_Print_Text Example, hope that was O.K. and configured the MD_MAX72xx Instances as follows.
// Define the number of devices we have in the strips and Code display and the hardware interface
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define MAX_DEVICES_BARGRAPHS 16
#define MAX_DEVICES_CODE 4
#define CLK_PIN 13 // or SCK
#define DATA_PIN 11 // or MOSI
#define CS_PIN 10 // or SS1
#define CS_PIN1 9 // or SS2
#define CS_PIN2 8 // or SS3
#define CS_PIN3 7 // or SS4
// SPI hardware interface
MD_MAX72XX mx0 = MD_MAX72XX(HARDWARE_TYPE, CS_PIN, MAX_DEVICES_BARGRAPHS); //Bargraph 1
MD_MAX72XX mx1 = MD_MAX72XX(HARDWARE_TYPE, CS_PIN1, MAX_DEVICES_BARGRAPHS); //Bargraph 2
MD_MAX72XX mx2 = MD_MAX72XX(HARDWARE_TYPE, CS_PIN2, MAX_DEVICES_BARGRAPHS); //Bargraph 3
MD_MAX72XX mx3 = MD_MAX72XX(HARDWARE_TYPE, CS_PIN3, MAX_DEVICES_CODE); // Used For Secret Code
MD_MAX72XX mx[] = {mx0, mx1, mx2, mx3};
I am using the code below
/**
Called when the puzzle is solved
*/void onSolve() {
#ifdef DEBUG
Serial.println("Puzzle has just been solved!");
#endif
//Set the Background Neopixle LEDS to Solid Green as Puzzle Has Been Solved
// use a loop to fill all Background Neopixel LEDS GREEN
for (int i = 0; i < numLedsBack; i++) {
// Set the i'th led to green
backleds[i] = CRGB(0, 255, 0);
FastLED.show();
message[BUF_SIZE] = "6 C 3 A";
printText(0, MAX_DEVICES_CODE - 1, message);
puzzleState = Solved;
}
}
to change the message but it doesn't seem to overwrite the original message "? ? ? ?" which is initially set in the void setup() section of the sketch.
I tried using
char message[BUF_SIZE] = "6 C 3 A
printText(0, MAX_DEVICES_CODE - 1, message);"
but this just screws ALL of the displays up ?
When the puzzle becomes un-solved the Code Display should return to "! ! ! !"
/**
Called when the puzzle (which previously had been solved) becomes unsolved
*/
void onUnsolve() {
#ifdef DEBUG
Serial.println("Puzzle has just become unsolved!");
#endif
//Set the Background Neopixle LEDS to Solid Red as Puzzle Has Been Un-Solved
for (int i = 0; i < numLedsBack; i++) {
// Set the i'th led to red
backleds[i] = CRGB(255, 0, 0);
// Show the leds
FastLED.show();
}
message[BUF_SIZE] = "! ! ! !";
printText(0, 4 - 1, message);
puzzleState = Running;
}
I have attached the full code in the hope you can point me in the right direction to why the "new message" isn't being sent to the Code display.
Regards,
Fimez.
short_detective.h (2.72 KB)
Compendium_Valves_With_Secret_Code_Display.ino (9.44 KB)