'HTmatrix' was not declared in this scope

this is what caused the error message

Arduino: 1.8.5 (Windows Store 1.8.10.0) (Windows 10), Board: "Arduino/Genuino Uno"

C:\Users\Owen\Downloads\sketch_aug01f\sketch_aug01f.ino: In function 'void Head()':

sketch_aug01f:10: error: 'HTmatrix' was not declared in this scope

   HTmatrix.drawRect((xPosition + 3),(yPosition + 2),3,3,1);

   ^

C:\Users\Owen\Downloads\sketch_aug01f\sketch_aug01f.ino: In function 'void body()':

sketch_aug01f:14: error: 'HTmatrix' was not declared in this scope

   HTmatrix.drawLine((xPosition + 4),(yPosition + 5),(xPosition + 4),(yPosition + 9),1);

   ^

C:\Users\Owen\Downloads\sketch_aug01f\sketch_aug01f.ino: In function 'void right_Bottom_leg()':

sketch_aug01f:18: error: 'HTmatrix' was not declared in this scope

   HTmatrix.drawLine((xPosition + 6),(yPosition + 12),(xPosition + 6),(yPosition + 13),1);

   ^

C:\Users\Owen\Downloads\sketch_aug01f\sketch_aug01f.ino: In function 'void left_arm()':

sketch_aug01f:22: error: 'HTmatrix' was not declared in this scope

   HTmatrix.drawLine((xPosition + 3),(yPosition + 6),(xPosition + 1),(yPosition + 8),1);

   ^

C:\Users\Owen\Downloads\sketch_aug01f\sketch_aug01f.ino: In function 'void left_Top_leg()':

sketch_aug01f:26: error: 'HTmatrix' was not declared in this scope

   HTmatrix.drawLine((xPosition + 3),(yPosition + 10),(xPosition + 2),(yPosition + 11),1);

   ^

C:\Users\Owen\Downloads\sketch_aug01f\sketch_aug01f.ino: In function 'void right_arm()':

sketch_aug01f:30: error: 'HTmatrix' was not declared in this scope

   HTmatrix.drawLine((xPosition + 5),(yPosition + 6),(xPosition + 7),(yPosition + 8),1);

   ^

C:\Users\Owen\Downloads\sketch_aug01f\sketch_aug01f.ino: In function 'void right_Top_Leg()':

sketch_aug01f:34: error: 'HTmatrix' was not declared in this scope

   HTmatrix.drawLine((xPosition + 5),(yPosition + 10),(xPosition + 6),(yPosition + 11),1);

   ^

C:\Users\Owen\Downloads\sketch_aug01f\sketch_aug01f.ino: In function 'void leftBottomleg()':

sketch_aug01f:38: error: 'HTmatrix' was not declared in this scope

   HTmatrix.drawLine((xPosition + 2),(yPosition + 12),(xPosition + 2),(yPosition + 13),1);

   ^

C:\Users\Owen\Downloads\sketch_aug01f\sketch_aug01f.ino: In function 'void setup()':

sketch_aug01f:46: error: 'class Adafruit_HT1632LEDMatrix' has no member named 'Brightness'

   HTmatrix.Brightness(5);

            ^

exit status 1
'HTmatrix' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

this is the full code

#include "Adafruit_GFX.h"

#include "Adafruit_HT1632.h"

int xPosition;

int yPosition;

void Head() {
  HTmatrix.drawRect((xPosition + 3), (yPosition + 2), 3, 3, 1);
}

void body() {
  HTmatrix.drawLine((xPosition + 4), (yPosition + 5), (xPosition + 4), (yPosition + 9), 1);
}

void right_Bottom_leg() {
  HTmatrix.drawLine((xPosition + 6), (yPosition + 12), (xPosition + 6), (yPosition + 13), 1);
}

void left_arm() {
  HTmatrix.drawLine((xPosition + 3), (yPosition + 6), (xPosition + 1), (yPosition + 8), 1);
}

void left_Top_leg() {
  HTmatrix.drawLine((xPosition + 3), (yPosition + 10), (xPosition + 2), (yPosition + 11), 1);
}

void right_arm() {
  HTmatrix.drawLine((xPosition + 5), (yPosition + 6), (xPosition + 7), (yPosition + 8), 1);
}

void right_Top_Leg() {
  HTmatrix.drawLine((xPosition + 5), (yPosition + 10), (xPosition + 6), (yPosition + 11), 1);
}

void leftBottomleg() {
  HTmatrix.drawLine((xPosition + 2), (yPosition + 12), (xPosition + 2), (yPosition + 13), 1);
}

Adafruit_HT1632LEDMatrix HTmatrix = Adafruit_HT1632LEDMatrix(2, 3, 4);

void setup()
{
  HTmatrix.begin(ADA_HT1632_COMMON_16NMOS);

  HTmatrix.setTextWrap(false);

  xPosition = 0;
  yPosition = 0;
}


void loop()
{
  HTmatrix.clearScreen();
  Head();
  body();
  left_arm();
  right_arm();
  left_Top_leg();
  leftBottomleg();
  right_Top_Leg();
  right_Bottom_leg();
  HTmatrix.writeScreen();
  if (analogRead(A0) >= 600) {
    xPosition = xPosition + 1;

  }
  if (analogRead(A0) <= 400) {
    xPosition = xPosition - 1;

  }
  if (analogRead(A1) >= 580) {
    xPosition = yPosition + 1;

  }
  if (analogRead(A1) <= 380) {
    xPosition = yPosition - 1;

  }
  if (xPosition >= 17) {
    xPosition = 16;

  }
  if (xPosition <= -1) {
    xPosition = 1;

  }
  if (yPosition >= -1) {
    yPosition = 0;

  }
  if (yPosition <= 19) {
    yPosition = 18;

  }
  delay(100);

}

Don’t post screenshots of text! That is very unhelpful. When you encounter an error you’ll see a button on the right side of the orange bar “Copy error messages”. Click that button. Paste the error in a message here USING CODE TAGS (</> button on the toolbar). It is almost never appropriate to post screenshots but in some cases it is helpful to post images. In those cases you should attach and embed the image following these instructions:

Please post your full sketch. If possible you should always post code directly in the forum thread as text using code tags (</> button on the toolbar). This will make it easy for anyone to look at it, which will increase the likelihood of you getting help. If the sketch is longer than the forum will allow then it’s ok to add it as an attachment. Don’t put your code in some external file service like dropbox, etc. We shouldn’t need to go to an external website just to help you. I do feel it’s reasonable to post a link to code hosted on GitHub or similar code hosting sites since that’s an platform specifically designed for this sort of thing

Please always do a Tools > Auto Format on your code before posting it. This will make it easier for you to spot bugs and make it easier for us to read. If you’re using the Arduino Web Editor then you will not have access to this useful tool. I recommend using the standard Arduino IDE instead.

When your code requires a library that’s not included with the Arduino IDE please post a link (using the chain links icon on the toolbar to make it clickable) to where you downloaded that library from or if you installed it using Library Manger (Sketch > Include Library > Manage Libraries) then say so and state the full name of the library.

Sorry, this is my first time posting on this. I am doing this for a class project and noone knows how to fix it.

Remove the line:-

Adafruit_HT1632LEDMatrix HTmatrix = Adafruit_HT1632LEDMatrix(2, 3, 4);

From where it is and place it at the start of your code after the #includes

#include "Adafruit_GFX.h"
#include "Adafruit_HT1632.h"

Adafruit_HT1632LEDMatrix HTmatrix = Adafruit_HT1632LEDMatrix(2, 3, 4);

Grumpy_Mike: Remove the line:-

Adafruit_HT1632LEDMatrix HTmatrix = Adafruit_HT1632LEDMatrix(2, 3, 4);

I don't understand why so many examples use that notation. Hate it. What's wrong with:

Adafruit_HT1632LEDMatrix HTmatrix(2, 3, 4);

Thank you, that fixed the problem.