i think you may be right ukheli i think my library is based off the adafruit library.
but i ran into a lack of brain power when trying to read rgbvalues i think it outputs.
thnx for the help bulldog .. i still think im not quite getting what i want from that ... but i plowed ahead and got pretty close to what i want i think by defining a temporary pinbank array at the start of the loop function and as i copy a pinnumber setting that pin number to a known string and a quick check for said string when setting the value.. which steps back in the loop to get another random value
#include <TimeLib.h>
#include <Wire.h>
#include <DS1307RTC.h> // a basic DS1307 library that returns time as a time_t
int digit1;
int digit2;
int digit3;
int digit4;
#include <NeoPixelBus.h>
const uint16_t PixelCount = 27; // this example assumes 4 pixels, making it smaller will cause a failure
const uint8_t PixelPin = 2; // make sure to set this to the correct pin, ignored for Esp8266
#define colorSaturation 128
NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin);
RgbColor red(colorSaturation, 0, 0);
RgbColor green(0, colorSaturation, 0);
RgbColor blue(0, 0, colorSaturation);
RgbColor white(colorSaturation);
RgbColor black(0);
HslColor hslRed(red);
HslColor hslGreen(green);
HslColor hslBlue(blue);
HslColor hslWhite(white);
HslColor hslBlack(black);
const byte houra [] = {26, 25, 24};
const byte hourb [] = {23, 22, 21, 20, 19, 18, 17, 16, 15};
const byte mina [] = {14, 13, 12, 11, 10, 9};
const byte minb [] = {8, 7, 6, 5, 4, 3, 2, 1, 0};
void setup() {
Serial.begin(9600);
// this resets all the neopixels to an off state
strip.Begin();
strip.Show();
setSyncProvider(RTC.get);// the function to get the time from the RTC
if(timeStatus()!= timeSet) {
Serial.println("Unable to sync with the RTC");
}
else{
Serial.println("Time retrieved from rtc");
delay(200);
delay(200);
}
}
void loop() {
displayTime();
}
void displayTime()
{
byte thoura [] = {26, 25, 24};
byte thourb [] = {23, 22, 21, 20, 19, 18, 17, 16, 15};
byte tmina [] = {14, 13, 12, 11, 10, 9};
byte tminb [] = {8, 7, 6, 5, 4, 3, 2, 1, 0};
for (int i=0; i <= PixelCount-1; i++){ // set all to 0
strip.SetPixelColor(i, black);
strip.Show();
}
digit1 = (hour() /10) %10;
digit2 = (hour() %10);
digit3 = (minute() /10) %10;
digit4 = (minute() %10);
//create pin arrays with length set to digit number
byte digit1pins[digit1];
byte digit2pins[digit2];
byte digit3pins[digit3];
byte digit4pins[digit4];
for(int q = 0; q <= digit1-1; q++){ //loop through count of hour digit 1
//setting hour pins with random selection of hourdigitbank 1 pins
int currv = random(0, 2);
byte curr = {thoura[currv]};
if (curr == "ret"){
q--;
}
else{
digit1pins[q] = curr;
thoura[currv] = "ret";
}
}
Serial.println(" ");
Serial.print("digit1pinscount:");
Serial.print(digit1);
Serial.println(" ");
Serial.print("digit1pinsValue:");
for(int q = 0; q <= digit1-1; q++){
for (int i=0; i <= digit1-1; i++){ // set all to 0
strip.SetPixelColor(digit1pins[q], red);
}
Serial.print(digit1pins[q]);
Serial.print(", ");
}
Serial.println(" ");
for(int q = 0; q <= digit2-1; q++){ //loop through count of hour digit 2
//setting hour pins with random selection of hourdigitbank 2 pins
int currv = random(0, 8);
byte curr = {thourb[currv]};
if (curr == "ret"){
q--;
}
else{
digit2pins[q] = curr;
thourb[currv] = "ret";
}
//digit2pins[q] = {hourb[random(0, 8)]};
}
Serial.println(" ");
Serial.print("digit2pinscount:");
Serial.print(digit2);
Serial.println(" ");
Serial.print("digit2pinsValue:");
for(int q = 0; q <= digit2-1; q++){
for (int i=0; i <= digit2-1; i++){ // set all to 0
strip.SetPixelColor(digit2pins[q], green);
}
Serial.print(digit2pins[q]);
Serial.print(", ");
}
Serial.println(" ");
for(int q = 0; q <= digit3-1; q++){ //loop through count of minute digit 1
//setting minute pins with random selection of minutedigitbank 1 pins
int currv = random(0, 5);
byte curr = {tmina[currv]};
if (curr == "ret"){
q--;
}
else{
digit3pins[q] = curr;
tmina[currv] = "ret";
}
//digit2pins[q] = {hourb[random(0, 8)]};
// digit3pins[q] = {mina[random(0, 5)]};
}
Serial.println(" ");
Serial.print("digit3pinscount:");
Serial.print(digit3);
Serial.println(" ");
Serial.print("digit3pinsValue:");
for(int q = 0; q <= digit3-1; q++){
for (int i=0; i <= digit3-1; i++){ // set all to 0
strip.SetPixelColor(digit3pins[q], blue);
}
Serial.print(digit3pins[q]);
Serial.print(", ");
}
Serial.println(" ");
for(int q = 0; q <= digit4-1; q++){ //loop through count of minute digit 2
//setting minute pins with random selection of minutedigitbank 2 pins
int currv = random(0, 8);
byte curr = {tminb[currv]};
if (curr == "ret"){
q--;
Serial.println(" ");
Serial.print("dupe:");
Serial.print(currv);
Serial.println(" ");
}
else{
digit4pins[q] = curr;
Serial.println(" ");
Serial.print("accepted currv:");
Serial.print(currv);
Serial.println(" ");
tminb[currv] = "ret";
}
//digit2pins[q] = {hourb[random(0, 8)]};
//digit4pins[q] = {minb[random(0, 8)]};
}
Serial.println(" ");
Serial.print("digit4pinscount:");
Serial.print(digit4);
Serial.println(" ");
Serial.print("digit4pinsValue:");
for(int q = 0; q <= digit4-1; q++){
for (int i=0; i <= digit4-1; i++){ // set all to 0
strip.SetPixelColor(digit4pins[q], red);
}
Serial.print(digit4pins[q]);
Serial.print(", ");
}
Serial.println(" ");
strip.Show();
delay(5000);
}
this outputs
accepted currv:4
accepted currv:0
accepted currv:0
accepted currv:7
accepted currv:3
accepted currv:1
accepted currv:6
accepted currv:2
accepted currv:3
digit4pinscount:9
digit4pinsValue:4, 8, 134, 1, 5, 7, 2, 6, 134,
digit1pinscount:1
digit1pinsValue:25,
digit2pinscount:5
digit2pinsValue:23, 19, 16, 21, 134,
digit3pinscount:5
digit3pinsValue:12, 14, 13, 11, 10,
accepted currv:5
accepted currv:1
accepted currv:3
accepted currv:1
accepted currv:2
accepted currv:6
accepted currv:3
accepted currv:0
accepted currv:1
digit4pinscount:9
digit4pinsValue:3, 7, 5, 134, 6, 2, 134, 8, 134,
this is 90% there to what i need i believe ... but i have made a mistake somewhere.... it is generating weird values occasionally
correction.... it is outputting 134 randomly(not in the array) .... tells me im doing some simple mistake and trying to output text or something as one of the digits?