The Best DIY STEM Tutorials and Projects

Your First Arduino Code

OVERVIEW

In This tutorial, we’re going to walk you through creating your very first Arduino code to blink an LED using mBlock’s block programming. It’s going to be fun, easy, and a great introduction to the world of Arduino programming. So, let’s dive right in!”

You can choose between two fun ways to learn:

Option 1: Watch the cool video tutorial to see and follow along step by step.

Option 2: If you like reading, check out the easy-to-follow written instructions below.

Video Tutorial

Awesome work, buddy! If you have any questions or need help, just leave a comment or contact us. We’re always here to help you out!

Tell us in the comments how you feel about making your first Arduino CODE, we will soon make many more cool stuff 🌟💡

Don’t forget to share a video of your project with us, thanks!

Components Required

For This Project You will need the following components:

Sr #Item NameQuantity
1Arduino Uno1
2Arduino Uno’s Cable1
3LED1
4Laptop or a PC1

Circuit Diagram

First Things First, Lets Setup the Circuit as shown in the image below

  1. Connect the Arduino Uno’s board to the Laptop using the Data Cable.
  2. Insert the LED in the Arduino, with the longer leg (the positive side) in Pin 13 and the shorter leg (the negative side) in G N D as shown in the image above

Good Job! Our circuit is now set up and ready to go.

Coding With Mblock

Now comes the fun part! We’re going to program our LED to blink. Here’s how:

  1. Open Mblock and go to devices
  2. In the mBlock interface, go to ‘Devices’ and select the Arduino UNO. Remove Other Devices if there are any
  3. Add Arduino Uno from Devices
  4. Now Find add the following blocks, your code should look like this
  • when Arduino Starts Up
  • ——forever
  • —————set digital pin (13) output as high
  • —————wait (1) seconds
  • —————set digital pin (13) output as low
  • —————wait (1) seconds

also shown in the image below

Now upload the code to Arduino!

Share your love

Leave a Reply

Your email address will not be published. Required fields are marked *