Interface and Application Programming

Task Requirments:

Idea:

The Idea is to make a simple GUI "Graphical User Interface" to control the LED in my Hello Echo Board.

The GUI will be two buttons "ON & OFF" to switch the LED on and off.

Exploring the options:

From the initial research i found two options, Python and Processing

So i went through This tutorial on codeacademy to explore Python, and This tutorial to explore Processing.

I choose to use processing as it will be easier to integerate with Arduino IDE which is the programming platform that i use.

Processing Code:

I google how to control a led with processing and found this nice Instructable.

I downloaded the Processing code from the instructable which controls 8 LEDs through eight buttons.

Editing the code:

Void setup():

I just need two buttons so I started by editing the canvas size to (200, 100).

Void draw():

I want one button to be red and the other green, so i edited the fill before the first rectangle ton the RGB code of green (0,128,0) "which i googled".

I added ON and OFF texts by defining the size and coordinates as shown below, i tried different sizes and coordinates until i reached the shape i wanted.

Void mouseaction():

I removed the If conditions of the extra buttons.

I Changed the coordinates to match my new canvas size.

I changed the myport.write to write O for ON and F for OFF.

Arduino Code:

I made a simple code with a variable to store the serial input and turn on the LED if Ois received and turn off the LED if F is received.

Connecting the board:

I connected the board with the FTDI cable, and from the tools tab on Arduino IDE i checked the port of the board.

i ran the processing code, and form the list of ports i found the board port is the second, so i changed the serial.list to 1 because countong starts from 0.

And here is the final result: