# How I learned to Program

I’d just like to encourage everybody to participate whatever your skill level might be at the moment, and not to worry about other people working on their own stuff at different levels in the background. Remember:

EVERY SINGLE PERSON HERE WAS AN ABSOLUTE BEGINNER AT ONE POINT.

People helped us. And the learning never stops. People still help us all the time. We’re more than happy to pass that along. There’s something here for everybody, so dive in, ask many questions, share code and learn with us!

Personally, the two things that helped me the most with programming were:

• Playing with example code (in my case, laboriously typing in and debugging programs from Byte magazine.)
• Asking questions. Super important! I made a great pest of myself in the computer lab, but the established hacker people were helpful and tolerant. Slowly, I learned and improved, 'till one day, people were asking me questions, which still seems weird, but that’s pretty much how the wheel turns.
3 Likes

Excellent thoughts. I believe the best way to learn is to take on tasks that require stretching. And failing isn’t a bad thing, it’s a way to learn more, as you learn how to do it.

I printed out a thing from electromage I hand-titled “An Introduction to Pixelblaze Code” but didn’t not the exact link and cannot now find it on the site. It looks like some interactive format allowing real-time editing…

I’m getting lost with terminology/syntax so I’ve started an Excel sheet with things like “array”…
what is an array, and what is its basic use?

I still do not really know.

“Slider”… a way of taking a variable out of the bulk code so it can be easily varied?

Still not sure about delta… etc.

Working on it.

Introduction is a pattern, I believe.

Array = a group of values, each in a slot, starting at zero.

So samplearray[0] is the first value
Samplearray[1] is the second. And so on.
Limitation of PB: you need to set the size of an array ahead of time and can’t change that later.

Slider: add a slider to the interface so you can adjust the value. Look at some examples.

Delta, good discussion recently. Basically it’s how long it took to render one set of pixels.

Yes , Intro is a pattern, thank you!

1 OK. So an array is a one dimensional “string” of values… super.

1. Can one “fill” an array with non-math-derived values, say 100, 325, 450, 300 … use them, say, to drive number of LEDs lit?

2. Delta is a dependent variable, correct? That’s where I got stuck, not its definition but its relationship. On my presently somewhat confused state, it seems to be great variable “art” to mess with delta thru code.

3. Your help is brilliant, exemplary. Super.

You can fill an array with any values, yes.
It’s just an ordered set of values.

“Delta” is just a way to measure speed.
To be clearer:

BeforeRender(howlong)
Would put that measurement into “howlong”

Delta is just a convention, a standard name.
It’s what we measured that matters.

Many, Many years ago I was in a class where we were working on a raytracing program… and adding different functionality to it. To me the best part of the class was seeing the spectacular imagines that were generated from mistakes in code. There is beauty in chaos.

3 Likes

I found the links above very helpful as I was able to download the pattern code and see how it was working. I think this is what you are referring to earlier with the introduction pattern.

that Github resource from @Jeff is amazing!
There’s Kelvin to rgb color conversion, even!
Now if I only knew what to do with it…!

Yep just save the JS files from here
https://github.com/jvyduna/pb-examples/tree/master/src
and change the file extension to TXT if you want /need to. Then you can open them with notepad or any cell phone app that reads text files.

1 Like

If you’re using Windows, I highly recommend Notepad++ for this job. It’s fast, just as easy to use as Notepad or Wordpad, and has many more useful features, like:

• syntax highlighting for javascript (and other languages). This makes reading pattern code much easier.
• bracket/brace/parenthesis matching.
• column mode editing and lots of other tools for cleaning up weirdly formatted code or data.
• it has a plugin that understands markdown, so it’s great for writing readme files.

I use it every single day, even though I have multiple full featured IDEs ready to go. Sometimes you just want a lightweight tool.

(Also, if you’re on Windows, right click and use “Open With” to set the program associated with .js files to the editor you like to use. It saves you from having to rename them, and eliminates one possible way of running random evil code by accidentally clicking on it.)

3 Likes

Great advice, I forgot about that notepad++ program. Anything you could recommend for an Android app to look at JS files?

@sealavie, I’d say the paid version of DroidEdit, but it’s been a while – after a couple of incidents while traveling internationally in the before times, I’ve become very much a phone minimalist.

Raytracing must have been amazing. Reflections in 3D and etc, plus refraction in translucent/transparent materials just to start with. All I ever did was some work in capture and light piping of UV in window glass, you know Snell’s Law stuff… in another life long ago.

Indeed, accidental stuff can be the seed of many fun things. That’s partly why we have to like the realtime editor for Pixelblaze. Besides, its just fun to play with.

1 Like

### How I learned to Program

The spark of interest for me was early in school. I think I was 9, and this other kid sat down at the computer, typed some stuff, and made his own text adventure game with whatever he wanted right before my eyes. What sorcery is this? What a power to be weld by a mere mortal. I was enthralled.

For the next few years I spent whatever time and access I had writing beginner software and trading goodies from my lunch to other kids for programming secrets, and reading the code (and barely understanding any of it) for anything I could find. The more I tried and failed, the more small pieces started to click in to place and the secrets of coding were unlocked.

Perhaps to a professional my code was un-clever, redundant, inefficient, and clunky, but none of that mattered or matters as it was and still is pure magic to me.

I’ve taken few programming courses, my primary training has and continues to come from exploration and curiosity.

4 Likes