Lab 1 – Hello World

Objective :

  1. To familiarize Pinguino IDE
  2. Program Pinguino to drive LED on-board.

Equipment:

  1. PIC 18F4550 microcontroller board with pre-programmed Pinguino bootloader version 4.x.
  2. USB cable

Requirement:

  1. Steps on prerequisite on Software and Hardware parts must be done.

Steps:

  • Open Pinguino IDE.

lab1-1

  • From Toolbar at the right-hand side, click on “01.Basics“.
  • Click on folder “Blink” and open “Blink.pde“.
  • A source code file that contains programming below will show on IDE’s editor windows.
/*
Blink a LED
*/
void setup()
{
// initialize the digital pin USERLED as an output.
pinMode(USERLED, OUTPUT);
}

void loop()
{
toggle(USERLED); // alternate ON and OFF
delay(1000); // wait for 500ms
/* Or ...
digitalWrite(USERLED, HIGH);
delay(500); // wait for 500ms
digitalWrite(USERLED, LOW);
delay(500); // wait for 500ms
*/
}

  • This programming is a simple example to let the LED blinks every 1 second.
  • Do not modify the code.
  • Goto “Settings” and select “Board Configuration“. Modify the setting as shown picture below.

lab1-2

  • Click “Accept“.
  • Goto “Pinguino” and select “Compile“. This will start to compile source code and if the source code is clean of error(s), IDE will pop up a small windows to inform compilation done.
  • Now connect Pinguino board to computer using USB cable.
  • Press “Reset” button on the board to let PIC boot into bootloader mode or else no code is allowed to upload to PIC.
  • Press “Upload Now!” to upload source code to PIC microcontroller.
  • If the code is successfully uploaded, a small pop up will show “File successfully uploaded to Pinguino“.
  • Now user should see the LED on the board start blinking, with 1 second interval.

 

Lab Exercise:

  1. Modify the code so that LED can blink faster. Upload the code to PIC.
  2. Modify the code so that LED can blink slower. Upload the code to PIC.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s