PLAYSTATION_PICO_II

Local multiplayer device with two potis & one 8×8 LED Matrix

This tutorial uses the LED MATRIX LIB of https://registry.platformio.org/libraries/electro707/Simple%20LED%20Matrix

#include <Arduino.h>

// thanks for the help: https://registry.platformio.org/libraries/electro707/Simple%20LED%20Matrix

#include "simple_matrix.h" //Import the library

/*
If you notice that the display is upside-down per display, change 
simpleMatrix disp(4, false, NUMBER_OF_DISPLAYS); to simpleMatrix disp(4, true, NUMBER_OF_DISPLAYS);
*/
simpleMatrix dotmatrix(4, false, 1);


int poti_one_pin = A0;
int poti_two_pin = A1;

int one_in_raw = 0;
float one_in = 0;

void setup() {
 
  dotmatrix.begin();
  //Set the LED's intensity. This value can be anywhere between 0 and 15.
  dotmatrix.setIntensity(15);
}


void readInputs(){
  one_in_raw = analogRead(poti_one_pin);
}


void loop() {

  readInputs();

  one_in = float(one_in_raw)/float(1024);

 //switch one random dot on
 int rx = int(random(8)*one_in);
 int ry = int(random(8));
 dotmatrix.setPixel(rx,ry);

  rx = int(random(8));
  ry = int(random(8));
  dotmatrix.clearPixel(rx,ry);
}