Introduction: Arduino IDE Using Dp32

Making an Arduino program

Step 1: Step 1: Start

First start up your Arduino IDE. A window like shown should pop up with basic code.

Step 2: Step 2: Check Tools

Secondly check to make sure that you have the correct board and port selected. This will be under the tools option. We are assuming that you have already unloaded your hex file into your board.

Step 3: Step 3: Writing Basic Code

Since assuming new to using Arduino, we are going to start we basic code and then made it a bit more complex. The following code is a simple push a button and an LED will turn on.

Step 4: Step 4: Running the Code

First you will click on the green check mark that is on the top left of the Arduino IDE to verify that your code works. Then when that is complete, you will press the green arrow right beside it to run/upload your code onto your Arduino. When complete, if you click on any of the buttons on your board, we will notice that one of the LEDs will light up. Pressing a different button will light up a different LED.

Step 5: Step 5: Upgrading Basic Code

Now since we got the basic, push button and turn an LED on, we will upgrade the code a bit to make it do a bit more. We will first change the top of our code so we have all 4 of our LEDs defined separately and we will also have a counter to keep track of the LEDs as shown.

Step 6: Step 6: Loop

Now we are going to change our IF statement so instead of a single LED turning on when a button is pressed, we are going to have a certain amount of LEDs turn on when you press a button. The first time you press a button, a single LED should turn on, pressing again will turn on a 2nd LED, then the 3rd and lastly the 4th so after 4 presses, all 4 LEDs should turn on and if you press again, the last 3 LEDs will turn off and start again from 1.

Step 7: Step 7: Running the Upgraded Code

Now when you run the code and try it, you will see that now the LEDs light up depending on how many times you can pressed the buttons. Pressing the buttons fast enough you will notice that the LEDs will looking like a loading bar that keeps looping. Now with these bits of basic code, you can easily play around with what the LEDs do when you press the buttons and how many buttons have been pressed. Play around and enjoy!

Comments

author
peabody1929 made it! (author)2016-04-03

How did you get "chipkit dp32" into the tools menu? The processor on that board is a Microchip PIC32. It is interesting to learn the Arduino IDE can be used with a PIC based board.

author
JayWeeks made it! (author)JayWeeks2016-06-07

Hopefully someone else has answered your question by now, but since I didn't see one here I figured I'd chime in.

Microchip came out with the chipKIT core for use with the Arduino IDE. There are a couple good tutorials on how to do this here in Instructables, but this is probably my favorite:

https://www.instructables.com/id/Christmas-Lightnin...

Hope that helps!

author
DIY Hacks and How Tos made it! (author)2016-04-03

Cool Arduino project.