Distance meter with Matrix display

Hi everyone,

this is my first time posting to the Arduino forum.

I'm begginer to Arduino programming and this is my first bigger project.

I need little help for making distance meter with ultrasonic sensor, thst displays distance value on MAX72 matrix display. I wrote a code that should be doing it.

The problem with code is that it always displays "1cm" on displays no matter what.
Code and library in attachmets.

Hope that section and topic is right.

LedControl-1.0.6.zip (9.61 KB)

display_ultrasonic_distance_2.ino (9.07 KB)

 if((distance=1))

Look at the reference for if else. = for assignment, == for compare. The outer parenthesis [()] are not necessary.