Interface and application programming
May 13, 2015
Assignment:
Write an application that interfaces with an input and/or output device.
Turning a DC motor forward, backwards,
left and right:
My goal this week was to control two DC motors using an interface created in the Processing program. The program displays an interface that responds to a mouse click as well as changing the color of the button pressed to black. When the mouse is clicked within the interface, the program writes data to the serial port. Software already programmed as part of the previous Network exercise in the ATMega88PB Microcontroller running on the PCB board, receives data from the serial port and turns the DC motor connected to the PWM pins ON and OFF. The motors turn forward together, turn backwards together and turn in opposite directions of each other in order to make a right or a left turn.
I made use of the same Circuit Board as in the Network assignment week:
I decided to use Processing to create an interface. I designed a simple interface design of four arrows and a middle circle. Each reprsenting "Forward" by the Up Arrow, "Backwards" by the Down Arrow, "Left Turn" by the Left Arrow and "Right Turn" by the Right Arrow. I aslo have a middle circle which represents and makes both motors stop. When you press any of the five interface buttons they change color (black) to confirm they have been pressed.
I then wrote a Java script (very similar to c programming) for the Control Panel Interface.
I achieve a forward motion by moving both motors in the same direction, which is opposite to the backwards motion. The side movements (left and right turns) are achieved by moving the motors in opposite directions to each other.
Here is the link to my Java Source Code for the Control Panel Interface using Processing:
Control Panel Interface using Processing