Introduction: Getting Started With Arduino and Codebender

Arduino is an open-source prototyping platform based on easy-to-use hardware and software.

The Arduino uno, Arduino mega and Arduino nano are some popular Arduino boards and are able to read inputs and turn them into outputs, for example you can press a button - input - and turn on/off an LED - output. You can easily use them with a breadboard for making your circuit and program them with the Arduino IDE.

With the Arduino IDE you can tell your board what to do by sending a set of instructions to the microcontroller on the board. To do so you use the Arduino programming language (based onWiring - C/C++).

Codebender is the online Arduino IDE and it's pretty cool! With Codebender you can program your favorite Arduino board directly from your browser and save all of your sketches in the cloud! It supports all the Arduino boards (official and compatible) and has already - ready to use - 544 libraries! (until today)

In this instructable we will see the most useful Arduino - functions and we will use the Codebender for programming the Arduino uno with a simple sketch, directly from our browser!

So, let's get started!

Step 1: Make Codebender Account

Codebender is the Largest Arduino Playground In The World, you can creat, share and run your code anywhere!

Advanced IDE

State of the art editor helps you code faster, get things done, and move on to other cool stuff. Our cloud compiler is not only fast, but also features amazing error reporting to help you find those pesky bugs. Use any board from our extensive list (88) of builtin and external boards, or upload your own board configuration. With almost 544 built-in libraries and 1895 library examples, you are sure to find the one you need, and get started in seconds.

The Power of Cloud
No need to install & maintain software and configurations anymore. No updates, no maintenance. All you need is a browser plugin. Got many computers, or recently bought a new one? Making last minute changes? Your code is always there, so you can access it anywhere. Unlimited public sketches, free of charge, for ever! Only pay if you want to keep your projects private.

Educate, Collaborate, Share
Looking for ideas? With over 168629 sketches on codebender, there are so many interesting ones to see. Find them, try them, and make them your own. Share a link to your sketch, or embed it in your website. Others can try your code on their Arduino instantly, with one click. Get in the classroom and start using arduino immediately!

Click here to make an account

Step 2: Arduino Drivers and Codebender Plugin

When the registration procedure completed you will automatically redirect to the "Getting Started - Walkthrough" page of Codebender.

In this page you will find an easy - step by step - guide to install the Arduino drivers to your system and the codebender plugin in your browser.

After installation, Codebender will check if you are ready to go by testing your Arduino board. Connect it with your computer and run the test!

Now you are ready to write your first Arduino sketch! Click on the 'Homepage" button and processed to the next step.

Step 3: Write Your First Arduino Sketch!

Here's the Blink code, embedded using codebender!

We have changed the Arduino Blink example to blink an LED that is connected with Arduino digital pin 3 to blink for three seconds. The connections are pretty easy, see the image above with breadboard circuit schematic.

-----------------------------------------------------------------------------

As you can see on the below sketch, by using the " // " or " /* */" you can add comments in your code.

With "const" you can add some constants, type "int" show us that the "ledPin" is a number, and for this project is the number 3. (const int ledPin = 3;)

The setup() routine runs only once after power on, re-program or press the reset button. In the program below, the first thing you do is to initialize the pin 3 as an output pin by using the pinMode( ) function.

(pinMode(ledPin, OUTPUT);

The loop( ) routine runs over and over again, forever. In the main loop, you can turn on or off the LED by using the digitalWrite( ) function and you can "pause" the program for three seconds by using the delay() function. (3 sec are 3000 ms)

-----------------------------------------------------------------------------

Connect your Arduino board with your computer and click on the Run on Arduino button to program it with the Blink sketch. And that's it, you've programmed your first Arduino with the basic Blink sketch!

You can copy/paste the below code or click on the "Clone & Edit" button to store this code on your codebender cloud.

Most usefu Arduino functions:

  • pinMode(pin, INPUT/OUTPUT); Define if a pin is input or output
  • digitalWrite(pin, LOW/HIGH); Set a pin to low (0V) or high (5V) logic level
  • analogWrite(pin, from 0 to 255); Set a pin with a PWM value (more here)
  • digitalRead(pin); Read a digital value (0 or 1)
  • analogRead(pin); (Read an analog value (0 to 1023)
  • delay(ms); Pause your code for some ms (1s=1000ms)
  • tone(pin, frequency); Play a tone with a buzzer or piezo speaker (more here)
  • noTone(pin); Stop playing tone

-----------------------------------------------------------------------------

Try this!

In the above code change the delay time to 1s (delay(1000);) and the digitalWrite(ledPin,HIGH); with the analogWrite(ledPin, 100); function. How it changes the program?

Step 4: Well Done!

You have successfully completed this guide!

For more Arduino tutorials and cool projects you can visit our webpage: www.ardumotive.com

I hope you liked this, let me know in the comments!

Welcome to the Arduino world!