I am trying to make a Mazze generator using / and \ but I can't use them so I have to use ASCII values 47 and 92. I don't know how to use a random for two specific numbers. this is what I have so far it only prints /.
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SH110X.h>
long randNumber;
int slash[2] = {47, 92};
Adafruit_SH1107 display = Adafruit_SH1107(64, 128, &Wire);
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("128x64 OLED FeatherWing test");
delay(250); // wait for the OLED to power up
display.begin(0x3C, true); // Address 0x3C default
display.display();
delay(1000);
display.clearDisplay();
display.display();
display.setRotation(1);
display.setTextSize(1);
display.setTextColor(SH110X_WHITE);
display.setCursor(0,0);
}
void loop() {
// put your main code here, to run repeatedly:
randNumber = random(0, 1);
display.write(slash[randNumber]);
delay(10);
display.display();
}
You've been told what you've done wrong. Three times now, in fact. If you won't read, if you won't think, there's nothing more anyone can do to change that.