Wednesday, March 21, 2012

Communicating between PC and Arduino (Correction)


On March 19th, 2012, a youtube user called Sophie333C found a problem on video "Communicating between PC and Arduino".

Sophie333C's comment:
Hi, There seems to be a problem when you press send the second time around,
it only seems to update every second press of the button!

After two days, she sent me a solution. I tested her solution and it works fine. Now I can receive a answer
when I press the button for first time. Here is code of solution:

  answer = port_arduino.ReadByte()
        TextBox2.Text = Chr(answer)

I would like thank to Sophie333C to found out this problem.

Monday, March 12, 2012

Processing Language

Processing is an open source programming language and environment for people who want to create images, animations, and interactions.



Processing is for writing software to make images, animations, and interactions. The idea is to write a single line of code, and have a circle show up on the screen. 

Code:

void setup(){
  size(480,120); 
  ellipse(50,50,60,60);
}

void draw(){
  
}

The size(width,height) function has two parameters: the first sets the width of window and the second sets the height of window. 

The ellipse(x,y,width,height) function has four parameters: the first sets the x-coordinate of center, the second sets the y-coordinate of center, the third sets the width of ellipse and fourth sets the height of ellipse. The x and y coordinates for ellipse are the center of the shape. Processing doesn't have separate functions to make circle. To make this shape, use the same value for the width and the height parameters to ellipse().

I think Processing is interesting because I can use my knowledge of math to draw something or teach children how to draw square, rectangle, circle only using lines of code.

Tuesday, March 6, 2012

Problems with jQuery and Internet Explorer

I had a problem with jQuery when I opened Internet Explorer. I couldn't see Date Picker!


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <script type="text/javascript" src="js/datepicker-2.6.js"></script>
        <script type="text/javascript" src="js/jquery-1.7.min.js"></script>
        <title></title>
    </head>
    <body>
        <input id="date" name="date"/>(dd/mm/yyyy)
        <script type="text/javascript" >
            var dp0 = new DatePicker("#date",{format:"d/m/Y",displayWeekNumbers:true});
        </script>
    </body>
</html>


To correct the problem, you have to add the next statement: <meta http-equiv="X-UA-Compatible" content="IE=edge"/>



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <script type="text/javascript" src="js/datepicker-2.6.js"></script>
        <script type="text/javascript" src="js/jquery-1.7.min.js"></script>
        <title></title>
    </head>
    <body>
        <input id="date" name="date"/>(dd/mm/yyyy)
        <script type="text/javascript" >
            var dp0 = new DatePicker("#date",{format:"d/m/Y",displayWeekNumbers:true});
        </script>
    </body>
</html>