Starting Arduino

I have started a new Project in relating to open hardware Arduino.

[Project Blog]
More Details and Infos can be found in the following blog.

Project Blog: http://roboticsgiesing.wordpress.com/

I think this could be very exciting for a layman like me to starting programming hardware.

[Development]
The development tool can be downloaded from http://arduino.cc/playground/Main/DevelopmentTools

[Examples]
Short Introduction to start programming microcontroller arduino

Advertisements

how to use switch in java

import java.util.Scanner;

/**
 * after the first case match in switch, all the subsequence will be executed, regardless the 
 * subcase sequence. In this example with the input "1", the both pl() for 1 and 2 will be executed
 * till the break statement. string equals are implemented in switch Methode
 * @author yingding
 *
 */

public class Main {
    static Scanner scanner = new Scanner (System.in);
    static String input = "";
    /**
     * @param args
     */
    public static void main(String[] args) {
        pl("This is a switch syntax tests");

        while (!input.equals(new String("q"))) {
        // the string equals are needed, otherwise the input != "q" is always true.
            input = scanner.nextLine();

            switch(input) {
            case "1" :
                pl("case 1: detected \"" + input +"\"");
            case "2" :
                pl("case 2: detected \"" + input +"\"");
                break;
            default:
                pl("default detected \"" + input + "\"");
                break;
            }
        }
        pl("User end this program with input q");

    }

    private static void pl(String in) {
        System.out.println(in);
    }

}