Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Week 15

Lab session

wokwi

#include <MD_MAX72xx.h>
#include "m1010_led.h"

//Initialise your LED display


// ****
//YOU NEED TO CHANGE THE LINE BELOW TO RUN THE DEMO IN RELOAD!!!
MD_MAX72XX matrix = MD_MAX72XX(MD_MAX72XX::PAROLA_HW, CS_PIN, MAX_DEVICES);

int x = 0;
int y = 0;

void setup() {
  matrix.begin();
  matrix.clearScreen();

// the loop function runs over and over again forever


void loop() {
 
  matrix.drawPixel(y, x, true);

  matrix.writeScreen();

  x = x+1;
  y = y;
  delay(100);
}

Reload

#include "Adafruit_GFX.h" //Add graphics support to the LCD display


#include "Adafruit_HT1632.h" //Add support for the LCD display

#define HT_DATA 2
#define HT_WR 3
#define HT_CS 4
#define HT_CS2 5

//Initialise your LED display


// ****
//YOU NEED TO CHANGE THE LINE BELOW TO RUN THE DEMO IN RELOAD!!!
Adafruit_HT1632LEDMatrix matrix = Adafruit_HT1632LEDMatrix(HT_DATA, HT_WR,
HT_CS, HT_CS2);
int hello[16][24] ={{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},//
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,1,0,0,1,0,1,1,1,0,1,0,0,0,1,0,0,0,1,1,1,0,0},
{0,0,1,0,0,1,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,1,0,0},
{0,0,1,0,0,1,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,1,0,0},
{0,0,1,0,0,1,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,1,0,0},
{0,0,1,0,0,1,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,1,0,0},
{0,0,1,1,1,1,0,1,1,0,0,1,0,0,0,1,0,0,0,1,0,1,0,0},
{0,0,1,0,0,1,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,1,0,0},
{0,0,1,0,0,1,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,1,0,0},
{0,0,1,0,0,1,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,1,0,0},
{0,0,1,0,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}; //DEFINE YOUR 2D ARRAY.

void setup() {
  matrix.begin(ADA_HT1632_COMMON_16NMOS); //startup the LED matrix display
  matrix.clearScreen();
  delay(500);
}

// the loop function runs repeatedly forever


void loop() {
  int row = 0;
  int col = 0;
  matrix.clearScreen();
  for(col=0;col<=15;col=col+1){

  for(row=0;row<=23;row=row+1){

  matrix.drawPixel(col, row, hello[col][row]);


  matrix.writeScreen();
  delay (5);
  }
  }
}

Self-study

int dio_pin_1 = 13;


int dio_pin_2 = 12;
int dio_pin_3 = 11;
int dio_pin_4 = 10;
int dio_pin_5 = 9;
void setup() {
  pinMode(13, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(9, OUTPUT);
}

void loop() {
  digitalWrite(13, true);
  digitalWrite(12, true);
  digitalWrite(11, true);
  digitalWrite(10, true);
  digitalWrite(9, true);
  delay(1000);
  digitalWrite(13, false);
  digitalWrite(12, false);
  digitalWrite(11, false);
  digitalWrite(10, false);
  digitalWrite(9, false);
  delay(1000);

Week 16

Lab session

Wokwi

Reload

Self-study

You might also like