-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRobot.java
More file actions
59 lines (39 loc) · 1.63 KB
/
Robot.java
File metadata and controls
59 lines (39 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package robot.robonce;
/*
* Clase: Robot
* Descripción: Gestiona el Robot.
* Autor: Miguel Ruiz Nogués.
*/
import java.io.IOException;
import lejos.nxt.LightSensor;
import lejos.nxt.SensorPort;
import lejos.nxt.remote.NXTCommand;
import lejos.pc.comm.NXTComm;
import lejos.pc.comm.NXTConnector;
public class Robot {
public static void main(String[] args) throws IOException {
//Crear Conexión:
NXTConnector conn = new NXTConnector();
if (!conn.connectTo("MIGUELO", NXTComm.LCP)) {
System.err.println("Fallo en la Conexión");
System.exit(1);
}
NXTCommand.getSingleton().setNXTComm(conn.getNXTComm());
LightSensor lightproducto=new LightSensor(SensorPort.S4);
//TTS
System.setProperty("freetts.voices", "com.sun.speech.freetts.en.us.cmu_us_kal.KevinVoiceDirectory");
Voicemanager vm = new Voicemanager ();
//Crear Vector de productos:
Producto productos[]= new Producto [4];
productos[0] =new Producto (001, "ham",lightproducto);
productos[1]= new Producto (002, "cheese",lightproducto);
productos[2]= new Producto (003, "orange",lightproducto);
productos[3]= new Producto (004, "rise",lightproducto);
//LineFollower:
LineFollower linefollower=new LineFollower(lightproducto,productos,vm );
linefollower.calibrar();
linefollower.seguir_linea();
//Cerrar Conexión:
conn.close();
}
}