Blame view

PercTeacher/Sources/Main.java 925 Bytes
04949080   pfrison   PercTeacher stabl...
1
  import javax.swing.JOptionPane;
c5abccad   pfrison   PercTeacher inter...
2
3
  
  /* TODO list :
2b7b8e5c   pfrison   PercTeacher TODO ...
4
   *  - import -> execute actions
cd5544f2   pfrison   PercTeacher added...
5
   *  - textfields to tweak delays (+ button set to default)
04949080   pfrison   PercTeacher stabl...
6
   *  - clean Interface class
c5abccad   pfrison   PercTeacher inter...
7
8
9
   */
  
  public class Main {
04949080   pfrison   PercTeacher stabl...
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  	
  	public static void main(String[] args) throws InterruptedException {
  		String serialPort = null;
  		try {
  			serialPort = SerialPortChooserDialog.showSerialPortChooserDialog();
  		} catch (NoSerialPortException e) {
  			JOptionPane.showMessageDialog(null, "No serial port available !", "Error", JOptionPane.ERROR_MESSAGE);
  			System.exit(-1);
  		}
  		if(serialPort == null) System.exit(-1);
  
  		final SerialCom serialCom = new SerialCom(serialPort);
  		// arduino need time before accepting serial data
  		Thread.sleep(1000);
c5abccad   pfrison   PercTeacher inter...
24
  		
04949080   pfrison   PercTeacher stabl...
25
26
27
28
29
30
31
  		ActionList actionList = new ActionList(serialCom);
  		Interface i = new Interface(actionList, new Runnable() {
  			@Override
  			public void run() {
  				serialCom.close();
  			}
  		});
c5abccad   pfrison   PercTeacher inter...
32
  		i.setVisible(true);
c5abccad   pfrison   PercTeacher inter...
33
34
  	}
  }