2013/9/30 unsigned¤Ëµ¤¤ò¤Ä¤±¤ë

  • ¤¿¤À¤Îint¤Ç-¤¬¤Ä¤¯¤Î¤ÏÃͤ¬Â礭¤¤¾ì¹ç

2013/9/26 ATmega3238P¥Ö¡¼¥È¥í¡¼¥À¸å¤Î¥¹¥±¥Ã¥Á½ñ¤­¹þ¤ß¥á¥â

  • ¥ê¥»¥Ã¥È¥¹¥¤¥Ã¥Á¤Ë¤Ä¤±¤ë¥³¥ó¥Ç¥ó¥µ¤Ï0.1¦ÌF¤À¤È¾å¼ê¤¯¤¤¤¯¤±¤ì¤É¤â22pF¤À¤È½ñ¤­¹þ¤ß¤Ç¤­¤Ê¤¤(ÍÆÎ̤¬¾®¤µ¤¹¤®¤Æ¾å¼ê¤¯¥ê¥»¥Ã¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¤Î¤«¤â?)

2013/9/24 ATmega328P¤Î¥Ö¡¼¥È¥í¡¼¥À¡¼½ñ¤­¹þ¤ß¥á¥â(PU)

2013/9/23 ˺È÷Ï¿-Sparkfun.com MP3 Player Shield¤ò»È¤¦»þ¤Î¥Á¥å¡¼¥È¥ê¥¢¥ë»ØÄê¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤·¤Ê¤¤

  • Sparkfun.com MP3 Player Shield¤òUNO¤Ç»È¤¦»þ¤Ë¥¤¥ó¥¹¥È¡¼¥ë¤¹¤ë¥é¥¤¥Ö¥é¥ê¤Î¥Ô¥ó(SS¤ò10¢ª9)¤ËÊѹ¹¤·¤Ê¤¤¤È¤¤¤±¤Ê¤¤¡£
  • https://www.sparkfun.com/tutorials/295 ¤Î
    2_1.png
    ¡¡¤¬Â¸ºß¤·¤Ê¤¤¤Î¤Ç¤¹¤¬¡¢Arduino/libraries/SdFat/SdFatConfig.h¤Î°ìÈÖ²¼
    2_2.png
    ¡¡¤Ë¤¢¤ê¤Þ¤·¤¿¡£¤³¤³¤ÎCS¤ò10¢ª9¤ËÊѤ¨¤ë¤ÈÆ°¤­¤Þ¤·¤¿¡£

Eclipse¤ò»È¤Ã¤ÆJava¤Ç¥·¥ê¥¢¥ëÄÌ¿®

  • Æ°ºî´Ä¶­¡§Windows7 64bit
  • ¼ê½ç
 ­¡¥·¥ê¥¢¥ëÄÌ¿®¤ò¹Ô¤¤¤¿¤¤Eclipse¤Îpackage²¼¤ËÄɲå饤¥Ö¥é¥êÍѤΥե©¥ë¥À¤òºî¤ë¡Ê̾Á°¤Ï²¿¤Ç¤â¤¤¤¤¤±¤É¼Ì¿¿¤Ç¤Ïlib¡Ë
1.png
 ­¢ÄɲÃÍѤΥ饤¥Ö¥é¥ê¤ò¥¤¥ó¥¹¥È¡¼¥ë

¡¡¡¡¤³¤Î¥Õ¥©¥ë¥À¤ò²òÅष¤¿Ãæ¤Î¡¢

¡¡¡¡¡¡rxtxParallel.dll

¡¡¡¡¡¡rxtxSerial.dll

¡¡¡¡¡¡RXTXcomm.jar

¡¡¡¡¤ò¥³¥Ô¡¼¤·¤Æ¡¢­¡¤Î¥Õ¥©¥ë¥ÀÆâ¤Ë¥Ú¡¼¥¹¥È

  • ¤â¤·¤â¥Ñ¥½¥³¥ó¼«ÂΤ˥¤¥ó¥¹¥È¡¼¥ë¤·¤¿¤¤¾ì¹ç¤Ï¡¢Program FilesÆâ¤ÎJava¥Õ¥¡¥¤¥ë¤Î¥é¥¤¥Ö¥é¥ê¤ËÆþ¤ì¤ë¡Ê¤ä¤Ã¤Æ¤Ê¤¤¤Î¤ÇÆ°¤¯¤«¤ÏÉÔÌÀ¡Ë
 ­£Eclipse¤ÇLibrary  Path¤òÄɲ乤ë
  • Eclipse¤òµ¯Æ°
  • ¤Þ¤º¡¢¿·¤·¤¯ºî¤Ã¤¿¥Õ¥©¥ë¥À¤¬Æþ¤Ã¤Æ¤¤¤ëPackage̾¤ò±¦¥¯¥ê¥Ã¥¯¤·¤Æ¡¢Refresh¤òÁªÂò¡£¡Ê¤Þ¤¿¤Ï¡¢Package̾¤òÁªÂò¸å¡¢F5¤ò²¡¤¹¡£¡Ë ¡¡¡¡ ¤³¤ì¤Ç¡¢¿·¥Õ¥©¥ë¥À¤¬Package¤ËÃç´ÖÆþ¤ê¡£ ¡¡
  • Project¥¿¥Ö¤ÎProperties¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¡£Properties¤Îº¸¤ËJava Build Path¤¬¤¢¤ë¤Î¤Ç¥¯¥ê¥Ã¥¯¡£
  • Libraries¥¿¥Ö¤ò¥¯¥ê¥Ã¥¯¡£Add Jars...¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¡¢­¡¤Çºî¤Ã¤¿¥Õ¥©¥ë¥ÀÆâ¤ÎRXTXcomm.jar¤òÁªÂò¡£
    2.png
  • ¤³¤ì¤ÇÀßÄê¤Ï´°Î»¡£¤¢¤È¤Ï¥×¥í¥°¥é¥à¤ò½ñ¤¯¤Î¤ß¡£
 ­¤¥×¥í¥°¥é¥àºîÀ®
  • CommLight.java¡Ê¥á¥¤¥ó¤¬¤¢¤ë¥Õ¥¡¥¤¥ë¡Ë
     //port check
     //JDK check
     import java.io.*;
     public class CommLight{
    	static File sharedText;
    	
    	public static void main(String[] args){
           
           SerialComm serialcomm = new SerialComm();
           serialcomm.open();
           int i = 10;
           while(i>0){
           	serialcomm.write((byte)0x34);
           	try{
               	Thread.sleep(500);
               }catch(Exception e){
               	
               }
               serialcomm.write((byte)0x20);
               try{
               	Thread.sleep(500);
               }catch(Exception e){
               	
               }
               serialcomm.write((byte)0x78);
               try{
               	Thread.sleep(500);
               }catch(Exception e){
               	
               }
               i--;
           }
    		System.out.println("Hello, World");
    	}
    }
  • SerialComm.java
     import gnu.io.*;
     import java.io.*;
     import java.util.*;
     public class SerialComm implements SerialPortEventListener{
    	private SerialPort port;
     //	private static BufferedReader reader;
    	private InputStream in;
    	private OutputStream out;
    	SerialComm(){
    		super();
    	}
    	public void open(){
    		try {
    			// Serial port initialize
    			CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier("COM6");
    			port = (SerialPort)portId.open("USB Serial Port", 2000);
    			port.setSerialPortParams(
    					9600,					 // í êM롯ìx[bps]
    					SerialPort.DATABITS_8,   // ÉfÅ[É^ÉrÉbÉgêî
    					SerialPort.STOPBITS_1,   // ÉXÉgÉbÉvÉrÉbÉg
    					SerialPort.PARITY_NONE   // ÉpÉäÉeÉB
    					);
    			port.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);
    			try{
    				port.addEventListener(this);
    				port.notifyOnDataAvailable(true);
    				
    				in = port.getInputStream();
    				out = port.getOutputStream();
    			}catch(TooManyListenersException ex){
    				System.out.println("Error1: "+ex);
    			}
    		} catch (Exception e) {
    			System.out.println("Error2: " + e);
    			System.exit(1);
    		}
    	}
    	public void close(){
    		try{
    			in.close();
    			out.close();
    			port.close();
    		}catch(Exception e){
    			System.out.println("close: "+e);
    		}
    	}
    	public void read(){
    		try{
    			byte[] buffer;
    			int temp = in.available();
    			if(temp>0){
    				System.out.println("temp: "+temp);
    				buffer = new byte[temp];
    				temp = in.read(buffer);
    				int num = 0;
    				while(num<temp){
    					System.out.println("b "+num+": "+Integer.toHexString((byte)buffer[num]));
    					num++;
    				}
    			}
    			in.close();
    		}catch(Exception e){
    			System.out.println("error4: "+e);
    		}
    	}
    	public static String toHex(byte[] digest) {
    		StringBuilder sb = new StringBuilder();
    		for (byte b : digest) {
    			sb.append(String.format("%1$02X", b));
    		}
    		return sb.toString();
    	}
    	public void write(byte data){
    		try{
    			out.write((byte)data);   
    			out.flush();
    			//&#201;X&#201;g&#201;&#228;&#197;[&#201;&#196;&#199;&#8710;COM&#201;|&#197;[&#201;g&#199;&#63743;&#239;¢Ì&#199;¢ß&#199;&#200;&#232;&#224;&#243;&#249;
    		}catch(Exception e){
    			System.out.println("port exception: "+e);
    		}
    	}
    	public void run() {
    		try {
    			InputStreamReader isr = new InputStreamReader(System.in);
    			BufferedReader br = new BufferedReader(isr);
    			OutputStream out = port.getOutputStream();
    			boolean flagQuit = false;
    			while (!flagQuit) {
    				String input = br.readLine();
    				if (input.length() > 0) {
    					if (input.equals(":quit"))
    						break;
    					input += "\r";
    					out.write(input.getBytes("US-ASCII"));
    				}
    			}
    			port.close();
    		} catch (Exception e) {
    			System.out.println("Error3: " + e);
    		}
    	}
    	public void serialEvent(SerialPortEvent event) {
    		if (event.getEventType() == SerialPortEvent.DATA_AVAILABLE) {
    			read();
    		}
    	}
     }
 ­¥´°À®