Hello,
I was trying to create that digital rain seen in the matrix movies, and the only example I could find online of that code was this YouTube video (its pretty bad in the sense the OA didn't post the code). I basically just tried to freeze frame it in order to best copy the code.
The main issue I seem to be having is at the end of the code:
"'y' cannot be used as a function...."
My goal will be to run it on an Arduino Nano with this OLED:
UCTRONICS 0.96 Inch OLED Module 12864 128x64 Yellow Blue SSD1306 Driver I2C Serial Self-Luminous Display Board for Arduino Raspberry PI
Here is the code
#include <TFT_eSPI.h> // graphics and font library for 5733 driver chip
#include <SPI.h>
TFT_eSPI tft = TFT_eSPI(); //Invoke library, pins defined in user_setup.h
const int BUTTON=16;
const int LED=5;
int timedelay=25;
int height=160;
int width=120;
int y(120);
int x;
int temp;
char z;
byte randNumber; // if your random number
byte prevRand = 0; //could be initialized
void setup(void) {
tft.init();
tft.setRotation(0);
tft.fillScreen(TFT_BLACK);
tft.setTextColor(TFT_GREEN, TFT_BLACK); //adding a black
tft.setTextSize(1);
Serial.begin(57600);
pinMode(BUTTON,INPUT);
pinMode(LED, OUTPUT);
for (x=0;x<width;x=x+8)
{
temp=random(0,height/8)*8;
do
{
y(x)=random(0,height/8)*8;
) while (temp!=y(x));
)
)
void loop() (
for (x=0;x<width;x=x+8)
(
temp = random(0,10):
if (temp <= 2)
z=('0' + random(0,10));
else if (temp <= 4)
z=('a' + random(0,27));
else if (temp <= 6)
z=('A' + random(0,27));
else
z=(' ' + random(1,220));
if (x ==16)
tft.setTextColor(TFT_WHITE, TFT_BLACK);
else if (x ==48)
tft.setTextColor(TFT_WHITE, TFT_BLACK);
else if (x ==96)
tft.setTextColor(TFT_WHITE, TFT_BLACK);
else
tft.setTextColor(TFT_GREEN, TFT_BLACK);
tft.setCursor(x,(/x));
tft.print(z);
temp=y(x)=16;
if (temp < 0)//When there is negative value
temp= temp + height;
else if (temp >= height)
temp=0;
tft.setCursor(x,temp);
tft.print(z);
temp=y)(x)=80;
if (temp < 0)//When there is negative
temp= temp + height;
else if (temp >= height)
temp=0;
tft.setCursor(x,temp);
tft.print(" ");
temp=y(x)+8;
if (temp < 0) //When there is negative value
temp= temp + height;
else if (temp >= height)
temp=0;
y(x)=temp;
delay(6);
)
)
I would greatly appreciate any help or tips on how to get this working.
Thanks!