Writing and Understanding codes

I am new to microcontroller programming. I have never programmed before using GPIO pins, etc. I understand that you guys have provided us with the code but as I am totally new to this field I cannot understand the pin programs like “digitalwrite?pin0&stateHIGH.” I am familiar with JS,HTML, CSS and I would like help regarding where should I study and practice pin programming from. A textbook, or a website or certain video series. Please provide the links if possible at the earliest.

1 Like

Hey there, first off, welcome to the BOLT community.

Now for the second bit, you’re not really into the micro controller field, not yet. However…[quote=“hitesh.poddar2013, post:1, topic:514”]
I am familiar with JS,HTML, CSS and

since you’ve said this, I can relate to you.

Micro controllers are at lower levels of programming, think of the Bolt as a bridge that connects where you are, to where you want to go.

With the Bolt, the microcontroller programming has already been done for you. Any input/output signal controllers are placed into your hands. It’s like Windows. You don’t go around writing programs in binary, you write them in a nice decent language, compile an executable, and let Windows do the worrying for you.

So now, you’re good with JS, CSS, and HTML. Good! So you know how to use functions and stuff. So I’m gonna assume you’re lost about what the functions do. (I’d recommend using functions rather than links, much easier to learn with, and maintain)

Well, the functions just do one of two things. They send and output from a pin (Those li’l black rectangular tubes), or they receive an electrical input from it. digitalWrite and digitalRead. The newer updates to the functions (see, that’s why you use them. They’re malleable) allows you to do read or write from more than one pin.


For controlling the pins, you can use some of the functions like- digitalRead, digitalWrite, analogRead, analogWrite, digitalMultiWrite etc. as per your requirement. For each function there is a set of arguments that completely describe how you want to control the pin using that function.

For example consider digitalWrite function. Suppose you want to control an LED using bolt. Connect it to a digital pin (GPIO 0-7 are digital pins). Now when you use the function digitalWrite, think of what you need to specify to control the LED completely-
1) Which pin the LED is connected to: This is given by the argument ‘pin’. You have to specify the pin number there.
2) Whether you want to switch it On or Off: This is given by the argument ‘state’. You have to specify HIGH for switching On and LOW for Off.
Combining both, you get the function digitalWrite(pin,state). You can implement it easily using JS.

Similarly, you can try to understand the arguments for the other pin controlling functions and use them. As far as pin programming is considered, the logic is similar for all microcontrollers but the syntax and the method to program them varies a lot. You will have to read up on the specific device you are using to practice it.