Arduino and C# GUI


hi everyone!

i have 5 botooms(1st bottom-move forward,2nd-move back,3d-turn right,4th-turn left,5th-stop moving)

when user presses e.x. 1st bottom ,then robot moving forwad , when user presses 2nd robot moving , on ... when stopbottom pressed - robot stops

i'm interesting in developing application ,which implements logic. i've wrote simple code , think doest work properly.
code: [select]

using system;
using system.collections.generic;
using system.componentmodel;
using system.data;
using system.drawing;
using system.linq;
using system.text;
using system.windows.forms;

namespace arduinoproject
{
   public partial class myform : form
   {
       public int cyclenumber;

       void sendcommands(string commandname)
       {

           mytextbox.text += commandname;
       }
       private void selectsycle()
       {
           //for (; ; )
           {
               switch (cyclenumber)
               {
                   default:
                       break;
                   case 1:
                       sendcommands("moving forward");
                       break;
                   case 2:
                       sendcommands("turn left");
                       break;
                   case 3:
                       sendcommands("turn right");
                       break;
                   case 4:
                       sendcommands("move back");
                       break;
               }
          }
       }

       public myform()
       {
           initializecomponent();
       }

       private void moveforward_click(object sender, eventargs e)
       {
           cyclenumber=1;
           selectsycle();
       }

       private void turnleft_click(object sender, eventargs e)
       {
           cyclenumber=2;
           selectsycle();
       }

       private void turnright_click(object sender, eventargs e)
       {
           cyclenumber=3;
           selectsycle();
       }

       private void moveback_click(object sender, eventargs e)
       {
           cyclenumber=4;
           selectsycle();
       }

       private void pause_click(object sender, eventargs e)
       {

       }
   }
}


any ideas how improve it?



Arduino Forum > Forum 2005-2010 (read only) > Software > Development > Arduino and C# GUI


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums