Core Electronics Forum

Arduino code meaning

Text removed.

This is only part of a program. What’s the rest of it? What are you trying to do? Is this an example you’re trying to follow?

Yes it’s a example I’m trying to follow. Thanks you

Hi Maria,

Thanks for making a post :slight_smile:

There are two main parts to an Arduino Sketch: the setup() function which runs once when the Arduino is powered on, and, the loop() function which runs on a continuous loop after the setup() has completed.

Ordinarily the setup() function will set up the variables and other important details. Without this context (or knowing how the Arduino is wired up) it’s difficult to say what this code is supposed to do.

Just going off the variable names it looks like this program is to drive a servo motor when a button or switch is turned on.

Regards,
Oliver
Support | Core Electronics

You are correct it’s when a switch is turned on. Would you able to assist me reading each line of the code?

Hi Maria,

Can you please provide the rest of the code and the context (particularly what is connected to the Arduino and how)? Do you have a URL/link to the example you’re following?

Unfortunately without more information it’s impossible to say what this code is doing.

I’d recommend working through our Arduino for Beginners Workshop.

Regards,
Oliver
Support | Core Electronics

thank you I’ll try that. please delete my post

Hi Maria, If you wish to delete your posts you can do so by clicking the edit button on each post.