├── README.md
├── Tutorial JAVADUINO - Código Arduino
└── Tutorial JAVADUINO - Código Arduino.ino
└── Tutorial JAVADUINO - Código Java
├── build.xml
├── build
└── classes
│ ├── .netbeans_automatic_build
│ ├── .netbeans_update_resources
│ ├── IconoLedAmarillo.png
│ ├── IconoLedAmarilloApagado.png
│ ├── IconoLedRojo.png
│ ├── IconoLedRojoApagado.png
│ ├── JAVADUINO_Frame$1.class
│ ├── JAVADUINO_Frame$2.class
│ ├── JAVADUINO_Frame$3.class
│ ├── JAVADUINO_Frame.class
│ └── JAVADUINO_Frame.form
├── manifest.mf
├── nbproject
├── build-impl.xml
├── genfiles.properties
├── private
│ ├── config.properties
│ ├── private.properties
│ └── private.xml
├── project.properties
└── project.xml
└── src
├── IconoLedAmarillo.png
├── IconoLedAmarilloApagado.png
├── IconoLedRojo.png
├── IconoLedRojoApagado.png
├── JAVADUINO_Frame.form
└── JAVADUINO_Frame.java
/README.md:
--------------------------------------------------------------------------------
1 | Arduino---Java---JavaDuino
2 | ==========================
3 |
4 | Código Arduino y JAVA para establecer una comunicación entre la placa y JAVA por puerto serial.
5 |
6 | Para descargarlo:
7 | ~~~
8 | git clone https://github.com/GeekyTheory/Arduino---Java---JavaDuino.git
9 | ~~~
10 |
11 | Para más información, visitar: [Geeky Theory Tutorial](http://www.geekytheory.com/tutorial-java-arduino-javaduino/ "")
--------------------------------------------------------------------------------
/Tutorial JAVADUINO - Código Arduino/Tutorial JAVADUINO - Código Arduino.ino:
--------------------------------------------------------------------------------
1 | /*
2 | Autor: Mario Pérez Esteso
3 | Web: www.geekytheory.com
4 | Twitter: @geekytheory
5 | Facebook: www.facebook.com/geekytheory
6 | */
7 | const int LED_Rojo = 13;
8 | const int LED_Amarillo=12;
9 | int inByte = 0;
10 |
11 | void setup(){
12 | Serial.begin(9600); //Open the serial port
13 | pinMode(LED_Amarillo, OUTPUT);
14 | pinMode(LED_Rojo, OUTPUT);
15 | digitalWrite(LED_Amarillo, LOW);
16 | digitalWrite(LED_Rojo, LOW);
17 | }
18 |
19 | void loop(){
20 |
21 | if(Serial.available() > 0){
22 |
23 | inByte = Serial.read();
24 | Serial.println(inByte);
25 | if(inByte == '0')
26 | digitalWrite(LED_Amarillo, LOW);
27 | else if(inByte=='1')
28 | digitalWrite(LED_Amarillo, HIGH);
29 | else if(inByte=='2')
30 | digitalWrite(LED_Rojo, LOW);
31 | else if(inByte=='3')
32 | digitalWrite(LED_Rojo, HIGH);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Tutorial JAVADUINO - Código Java/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Builds, tests, and runs the project JAVADUINO.
12 |
13 |
74 |
75 |
--------------------------------------------------------------------------------
/Tutorial JAVADUINO - Código Java/build/classes/.netbeans_automatic_build:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyTheory/Arduino---Java---JavaDuino/740e3e1a23d73def93b9b5e15981f9fe2d1e3a50/Tutorial JAVADUINO - Código Java/build/classes/.netbeans_automatic_build
--------------------------------------------------------------------------------
/Tutorial JAVADUINO - Código Java/build/classes/.netbeans_update_resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyTheory/Arduino---Java---JavaDuino/740e3e1a23d73def93b9b5e15981f9fe2d1e3a50/Tutorial JAVADUINO - Código Java/build/classes/.netbeans_update_resources
--------------------------------------------------------------------------------
/Tutorial JAVADUINO - Código Java/build/classes/IconoLedAmarillo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyTheory/Arduino---Java---JavaDuino/740e3e1a23d73def93b9b5e15981f9fe2d1e3a50/Tutorial JAVADUINO - Código Java/build/classes/IconoLedAmarillo.png
--------------------------------------------------------------------------------
/Tutorial JAVADUINO - Código Java/build/classes/IconoLedAmarilloApagado.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyTheory/Arduino---Java---JavaDuino/740e3e1a23d73def93b9b5e15981f9fe2d1e3a50/Tutorial JAVADUINO - Código Java/build/classes/IconoLedAmarilloApagado.png
--------------------------------------------------------------------------------
/Tutorial JAVADUINO - Código Java/build/classes/IconoLedRojo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyTheory/Arduino---Java---JavaDuino/740e3e1a23d73def93b9b5e15981f9fe2d1e3a50/Tutorial JAVADUINO - Código Java/build/classes/IconoLedRojo.png
--------------------------------------------------------------------------------
/Tutorial JAVADUINO - Código Java/build/classes/IconoLedRojoApagado.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyTheory/Arduino---Java---JavaDuino/740e3e1a23d73def93b9b5e15981f9fe2d1e3a50/Tutorial JAVADUINO - Código Java/build/classes/IconoLedRojoApagado.png
--------------------------------------------------------------------------------
/Tutorial JAVADUINO - Código Java/build/classes/JAVADUINO_Frame$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyTheory/Arduino---Java---JavaDuino/740e3e1a23d73def93b9b5e15981f9fe2d1e3a50/Tutorial JAVADUINO - Código Java/build/classes/JAVADUINO_Frame$1.class
--------------------------------------------------------------------------------
/Tutorial JAVADUINO - Código Java/build/classes/JAVADUINO_Frame$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyTheory/Arduino---Java---JavaDuino/740e3e1a23d73def93b9b5e15981f9fe2d1e3a50/Tutorial JAVADUINO - Código Java/build/classes/JAVADUINO_Frame$2.class
--------------------------------------------------------------------------------
/Tutorial JAVADUINO - Código Java/build/classes/JAVADUINO_Frame$3.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyTheory/Arduino---Java---JavaDuino/740e3e1a23d73def93b9b5e15981f9fe2d1e3a50/Tutorial JAVADUINO - Código Java/build/classes/JAVADUINO_Frame$3.class
--------------------------------------------------------------------------------
/Tutorial JAVADUINO - Código Java/build/classes/JAVADUINO_Frame.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyTheory/Arduino---Java---JavaDuino/740e3e1a23d73def93b9b5e15981f9fe2d1e3a50/Tutorial JAVADUINO - Código Java/build/classes/JAVADUINO_Frame.class
--------------------------------------------------------------------------------
/Tutorial JAVADUINO - Código Java/build/classes/JAVADUINO_Frame.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
130 |
--------------------------------------------------------------------------------
/Tutorial JAVADUINO - Código Java/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/Tutorial JAVADUINO - Código Java/nbproject/build-impl.xml:
--------------------------------------------------------------------------------
1 |
2 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 | Must set src.dir
232 | Must set test.src.dir
233 | Must set build.dir
234 | Must set dist.dir
235 | Must set build.classes.dir
236 | Must set dist.javadoc.dir
237 | Must set build.test.classes.dir
238 | Must set build.test.results.dir
239 | Must set build.classes.excludes
240 | Must set dist.jar
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 | Must set javac.includes
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 |
433 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 |
447 |
448 |
449 |
450 |
451 |
452 |
453 |
454 |
455 |
456 |
457 |
458 |
459 |
460 |
461 |
462 |
463 |
464 |
465 |
466 |
467 |
468 | No tests executed.
469 |
470 |
471 |
472 |
473 |
474 |
475 |
476 |
477 |
478 |
479 |
480 |
481 |
482 |
483 |
484 |
485 |
486 |
487 |
488 |
489 |
490 |
491 |
492 |
493 |
494 |
495 |
496 |
497 |
498 |
499 |
500 |
501 |
502 |
503 |
504 |
505 |
506 |
507 |
508 |
509 |
510 |
511 |
512 |
513 |
514 |
515 |
516 |
517 |
518 |
519 |
520 |
521 |
522 |
523 |
524 |
525 |
526 |
527 |
528 |
529 |
530 |
531 |
532 |
533 |
534 |
535 |
536 |
537 |
538 |
539 |
540 |
541 |
542 |
543 |
544 |
545 |
546 |
547 |
548 |
549 |
550 |
551 |
552 |
553 |
554 |
555 |
556 |
557 |
558 |
559 |
560 |
561 |
562 |
563 |
564 |
565 |
566 |
567 |
568 |
569 |
570 |
571 |
572 |
573 |
574 |
575 |
576 |
577 |
578 |
579 |
580 |
581 |
582 |
583 |
584 |
585 |
586 |
587 |
588 |
589 |
590 |
591 |
592 |
593 |
594 |
595 |
596 |
597 |
598 |
599 |
600 |
601 |
602 |
603 |
604 |
605 |
606 |
607 |
608 |
609 |
610 |
611 |
612 |
613 |
614 |
615 |
616 |
617 |
618 |
619 |
620 |
621 |
622 |
623 |
624 |
625 |
626 |
627 |
628 |
629 |
630 |
631 |
632 |
633 |
634 |
635 |
636 |
637 |
638 |
639 |
640 |
641 |
642 |
643 |
644 |
645 |
646 |
647 |
648 |
649 |
650 |
651 |
652 |
653 |
654 |
655 |
656 |
657 |
658 |
659 |
660 |
661 |
662 |
663 |
664 |
665 |
666 |
667 |
668 |
669 |
670 |
671 |
672 |
673 |
676 |
677 |
678 |
679 |
680 |
681 |
682 |
683 |
684 |
685 |
686 |
687 |
688 |
689 |
690 |
691 |
692 |
693 |
694 |
695 |
696 |
697 |
698 |
699 |
700 |
701 |
702 |
703 |
704 |
705 |
706 |
707 |
708 |
709 |
710 |
711 |
712 |
713 |
714 |
715 |
716 |
717 |
718 | Must set JVM to use for profiling in profiler.info.jvm
719 | Must set profiler agent JVM arguments in profiler.info.jvmargs.agent
720 |
721 |
724 |
725 |
726 |
727 |
728 |
729 |
730 |
731 |
732 |
733 |
734 |
735 |
736 |
737 |
738 |
739 |
740 |
741 |
742 |
743 |
744 |
745 |
746 |
747 |
748 |
749 |
750 |
751 |
752 |
753 |
754 |
755 |
756 |
757 |
758 |
759 |
760 |
761 |
762 |
763 |
764 |
765 |
766 |
767 |
768 |
769 |
770 |
771 |
772 |
773 |
774 |
775 |
776 |
777 |
778 |
779 |
780 |
781 |
782 |
783 |
784 |
785 |
786 |
787 |
788 |
789 |
790 |
791 |
792 |
793 |
794 |
795 |
796 |
797 |
798 |
799 |
800 |
801 |
802 |
803 |
804 |
805 |
806 |
807 |
808 |
809 |
810 |
811 |
812 |
813 |
814 |
815 |
816 |
817 |
818 |
819 |
820 |
821 |
822 |
823 |
824 |
825 |
826 |
827 |
828 |
829 |
830 |
831 |
832 |
833 |
834 |
835 |
836 |
837 |
838 |
839 |
840 |
841 |
842 |
843 |
844 |
845 |
846 |
847 |
848 |
849 |
850 |
851 |
852 |
853 |
854 |
855 |
856 |
857 |
858 |
859 |
860 |
861 |
862 |
863 |
864 |
865 |
866 |
867 |
868 |
869 |
870 |
871 |
872 |
873 |
874 |
875 |
876 |
877 |
878 |
879 |
880 |
881 |
882 |
887 |
888 |
889 |
890 |
891 |
892 |
893 |
894 |
895 |
896 |
897 |
898 |
899 |
900 |
901 |
902 |
903 |
904 |
905 |
906 |
907 |
908 |
909 |
910 |
911 |
912 |
913 |
914 |
915 |
916 |
917 |
918 |
919 |
920 |
921 |
922 |
923 |
924 |
925 |
926 |
927 |
928 |
929 |
930 |
931 |
932 |
933 |
934 |
935 |
936 |
937 |
938 |
939 |
940 |
941 |
942 |
943 |
944 |
945 |
946 |
947 | Must select some files in the IDE or set javac.includes
948 |
949 |
950 |
951 |
952 |
953 |
954 |
955 |
956 |
961 |
962 |
963 |
964 |
965 |
966 |
967 |
968 |
969 |
970 |
971 |
972 |
973 |
974 |
975 |
976 |
977 |
978 |
979 |
980 |
981 | To run this application from the command line without Ant, try:
982 |
983 |
984 |
985 |
986 |
987 |
988 | java -cp "${run.classpath.with.dist.jar}" ${main.class}
989 |
990 |
991 |
992 |
993 |
994 |
995 |
996 |
997 |
998 |
999 |
1000 |
1001 |
1002 |
1003 |
1004 |
1005 |
1006 |
1007 |
1008 |
1009 |
1010 |
1011 |
1012 |
1013 | To run this application from the command line without Ant, try:
1014 |
1015 | java -jar "${dist.jar.resolved}"
1016 |
1017 |
1018 |
1019 |
1020 |
1021 |
1022 |
1023 |
1024 |
1025 |
1026 |
1027 |
1028 |
1033 |
1034 |
1035 |
1036 |
1037 |
1038 |
1039 |
1040 |
1041 |
1042 |
1043 |
1044 | Must select one file in the IDE or set run.class
1045 |
1046 |
1047 |
1048 | Must select one file in the IDE or set run.class
1049 |
1050 |
1051 |
1056 |
1057 |
1058 |
1059 |
1060 |
1061 |
1062 |
1063 |
1064 |
1065 |
1066 |
1067 |
1068 |
1069 |
1070 |
1071 |
1072 |
1073 |
1074 |
1075 | Must select one file in the IDE or set debug.class
1076 |
1077 |
1078 |
1079 |
1080 | Must select one file in the IDE or set debug.class
1081 |
1082 |
1083 |
1084 |
1085 | Must set fix.includes
1086 |
1087 |
1088 |
1089 |
1090 |
1091 |
1092 |
1097 |
1100 |
1101 | This target only works when run from inside the NetBeans IDE.
1102 |
1103 |
1104 |
1105 |
1106 |
1107 |
1108 |
1109 |
1110 | Must select one file in the IDE or set profile.class
1111 | This target only works when run from inside the NetBeans IDE.
1112 |
1113 |
1114 |
1115 |
1116 |
1117 |
1118 |
1119 |
1120 | This target only works when run from inside the NetBeans IDE.
1121 |
1122 |
1123 |
1124 |
1125 |
1126 |
1127 |
1128 |
1129 |
1130 |
1131 |
1132 |
1133 | This target only works when run from inside the NetBeans IDE.
1134 |
1135 |
1136 |
1137 |
1138 |
1139 |
1140 |
1141 |
1142 |
1143 |
1144 |
1145 |
1146 |
1147 |
1148 |
1149 |
1150 |
1151 |
1152 |
1153 |
1154 |
1155 |
1158 |
1159 |
1160 |
1161 |
1162 |
1163 |
1164 |
1165 |
1166 |
1167 |
1168 |
1169 |
1170 |
1171 | Must select one file in the IDE or set run.class
1172 |
1173 |
1174 |
1175 |
1176 |
1177 | Must select some files in the IDE or set test.includes
1178 |
1179 |
1180 |
1181 |
1182 | Must select one file in the IDE or set run.class
1183 |
1184 |
1185 |
1186 |
1187 | Must select one file in the IDE or set applet.url
1188 |
1189 |
1190 |
1191 |
1196 |
1197 |
1198 |
1199 |
1200 |
1201 |
1202 |
1203 |
1204 |
1205 |
1206 |
1207 |
1208 |
1209 |
1210 |
1211 |
1212 |
1213 |
1214 |
1215 |
1216 |
1217 |
1218 |
1219 |
1220 |
1221 |
1222 |
1223 |
1224 |
1225 |
1226 |
1227 |
1228 |
1229 |
1230 |
1231 |
1232 |
1237 |
1238 |
1239 |
1240 |
1241 |
1242 |
1243 |
1244 |
1245 |
1246 |
1247 |
1248 |
1249 |
1250 |
1251 |
1252 |
1253 |
1254 |
1255 |
1256 |
1257 |
1258 |
1259 |
1260 |
1261 |
1262 |
1263 | Must select some files in the IDE or set javac.includes
1264 |
1265 |
1266 |
1267 |
1268 |
1269 |
1270 |
1271 |
1272 |
1273 |
1274 |
1275 |
1280 |
1281 |
1282 |
1283 |
1284 |
1285 |
1286 |
1287 | Some tests failed; see details above.
1288 |
1289 |
1290 |
1291 |
1292 |
1293 |
1294 |
1295 |
1296 | Must select some files in the IDE or set test.includes
1297 |
1298 |
1299 |
1300 | Some tests failed; see details above.
1301 |
1302 |
1303 |
1304 | Must select some files in the IDE or set test.class
1305 | Must select some method in the IDE or set test.method
1306 |
1307 |
1308 |
1309 | Some tests failed; see details above.
1310 |
1311 |
1312 |
1317 |
1318 | Must select one file in the IDE or set test.class
1319 |
1320 |
1321 |
1322 | Must select one file in the IDE or set test.class
1323 | Must select some method in the IDE or set test.method
1324 |
1325 |
1326 |
1327 |
1328 |
1329 |
1330 |
1331 |
1332 |
1333 |
1334 |
1335 |
1340 |
1341 | Must select one file in the IDE or set applet.url
1342 |
1343 |
1344 |
1345 |
1346 |
1347 |
1348 |
1353 |
1354 | Must select one file in the IDE or set applet.url
1355 |
1356 |
1357 |
1358 |
1359 |
1360 |
1361 |
1362 |
1367 |
1368 |
1369 |
1370 |
1371 |
1372 |
1373 |
1374 |
1375 |
1376 |
1377 |
1378 |
1379 |
1380 |
1381 |
1382 |
1383 |
1384 |
1385 |
1386 |
1387 |
1388 |
1389 |
1390 |
1391 |
1392 |
1393 |
1394 |
1395 |
1396 |
1397 |
1398 |
1399 |
1400 |
1401 |
1402 |
1403 |
1404 |
1405 |
1406 |
1407 |
1408 |
1409 |
1410 |
1411 |
1412 |
--------------------------------------------------------------------------------
/Tutorial JAVADUINO - Código Java/nbproject/genfiles.properties:
--------------------------------------------------------------------------------
1 | build.xml.data.CRC32=d7b29f14
2 | build.xml.script.CRC32=d5c9ac0e
3 | build.xml.stylesheet.CRC32=28e38971@1.56.1.46
4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6 | nbproject/build-impl.xml.data.CRC32=d7b29f14
7 | nbproject/build-impl.xml.script.CRC32=f05346fe
8 | nbproject/build-impl.xml.stylesheet.CRC32=c6d2a60f@1.56.1.46
9 |
--------------------------------------------------------------------------------
/Tutorial JAVADUINO - Código Java/nbproject/private/config.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyTheory/Arduino---Java---JavaDuino/740e3e1a23d73def93b9b5e15981f9fe2d1e3a50/Tutorial JAVADUINO - Código Java/nbproject/private/config.properties
--------------------------------------------------------------------------------
/Tutorial JAVADUINO - Código Java/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | do.depend=false
3 | do.jar=true
4 | javac.debug=true
5 | javadoc.preview=true
6 | user.properties.file=/home/mario/.netbeans/7.3rc2/build.properties
7 |
--------------------------------------------------------------------------------
/Tutorial JAVADUINO - Código Java/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Tutorial JAVADUINO - Código Java/nbproject/project.properties:
--------------------------------------------------------------------------------
1 | annotation.processing.enabled=true
2 | annotation.processing.enabled.in.editor=false
3 | annotation.processing.processors.list=
4 | annotation.processing.run.all.processors=true
5 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
6 | application.title=JAVADUINO
7 | application.vendor=mario
8 | build.classes.dir=${build.dir}/classes
9 | build.classes.excludes=**/*.java,**/*.form
10 | # This directory is removed when the project is cleaned:
11 | build.dir=build
12 | build.generated.dir=${build.dir}/generated
13 | build.generated.sources.dir=${build.dir}/generated-sources
14 | # Only compile against the classpath explicitly listed here:
15 | build.sysclasspath=ignore
16 | build.test.classes.dir=${build.dir}/test/classes
17 | build.test.results.dir=${build.dir}/test/results
18 | # Uncomment to specify the preferred debugger connection transport:
19 | #debug.transport=dt_socket
20 | debug.classpath=\
21 | ${run.classpath}
22 | debug.test.classpath=\
23 | ${run.test.classpath}
24 | # This directory is removed when the project is cleaned:
25 | dist.dir=dist
26 | dist.jar=${dist.dir}/JAVADUINO.jar
27 | dist.javadoc.dir=${dist.dir}/javadoc
28 | endorsed.classpath=
29 | excludes=
30 | file.reference.RXTXcomm.jar=/usr/share/java/RXTXcomm.jar
31 | includes=**
32 | jar.compress=false
33 | javac.classpath=\
34 | ${file.reference.RXTXcomm.jar}
35 | # Space-separated list of extra javac options
36 | javac.compilerargs=
37 | javac.deprecation=false
38 | javac.processorpath=\
39 | ${javac.classpath}
40 | javac.source=1.7
41 | javac.target=1.7
42 | javac.test.classpath=\
43 | ${javac.classpath}:\
44 | ${build.classes.dir}
45 | javac.test.processorpath=\
46 | ${javac.test.classpath}
47 | javadoc.additionalparam=
48 | javadoc.author=false
49 | javadoc.encoding=${source.encoding}
50 | javadoc.noindex=false
51 | javadoc.nonavbar=false
52 | javadoc.notree=false
53 | javadoc.private=false
54 | javadoc.splitindex=true
55 | javadoc.use=true
56 | javadoc.version=false
57 | javadoc.windowtitle=
58 | main.class=JAVADUINO_Frame
59 | manifest.file=manifest.mf
60 | meta.inf.dir=${src.dir}/META-INF
61 | mkdist.disabled=false
62 | platform.active=default_platform
63 | run.classpath=\
64 | ${javac.classpath}:\
65 | ${build.classes.dir}
66 | # Space-separated list of JVM arguments used when running the project.
67 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
68 | # To set system properties for unit tests define test-sys-prop.name=value:
69 | run.jvmargs=-Djava.library.path="/usr/lib/jni/"
70 | run.test.classpath=\
71 | ${javac.test.classpath}:\
72 | ${build.test.classes.dir}
73 | source.encoding=UTF-8
74 | src.dir=src
75 | test.src.dir=test
76 |
--------------------------------------------------------------------------------
/Tutorial JAVADUINO - Código Java/nbproject/project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.netbeans.modules.java.j2seproject
4 |
5 |
6 | JAVADUINO
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Tutorial JAVADUINO - Código Java/src/IconoLedAmarillo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyTheory/Arduino---Java---JavaDuino/740e3e1a23d73def93b9b5e15981f9fe2d1e3a50/Tutorial JAVADUINO - Código Java/src/IconoLedAmarillo.png
--------------------------------------------------------------------------------
/Tutorial JAVADUINO - Código Java/src/IconoLedAmarilloApagado.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyTheory/Arduino---Java---JavaDuino/740e3e1a23d73def93b9b5e15981f9fe2d1e3a50/Tutorial JAVADUINO - Código Java/src/IconoLedAmarilloApagado.png
--------------------------------------------------------------------------------
/Tutorial JAVADUINO - Código Java/src/IconoLedRojo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyTheory/Arduino---Java---JavaDuino/740e3e1a23d73def93b9b5e15981f9fe2d1e3a50/Tutorial JAVADUINO - Código Java/src/IconoLedRojo.png
--------------------------------------------------------------------------------
/Tutorial JAVADUINO - Código Java/src/IconoLedRojoApagado.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeekyTheory/Arduino---Java---JavaDuino/740e3e1a23d73def93b9b5e15981f9fe2d1e3a50/Tutorial JAVADUINO - Código Java/src/IconoLedRojoApagado.png
--------------------------------------------------------------------------------
/Tutorial JAVADUINO - Código Java/src/JAVADUINO_Frame.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
130 |
--------------------------------------------------------------------------------
/Tutorial JAVADUINO - Código Java/src/JAVADUINO_Frame.java:
--------------------------------------------------------------------------------
1 |
2 | import gnu.io.CommPortIdentifier;
3 | import gnu.io.SerialPort;
4 | import java.io.OutputStream;
5 | import java.util.Enumeration;
6 | import javax.swing.ImageIcon;
7 | import javax.swing.JOptionPane;
8 |
9 | /*
10 | * To change this template, choose Tools | Templates
11 | * and open the template in the editor.
12 | */
13 |
14 | /**
15 | *
16 | * @author mario
17 | */
18 | public class JAVADUINO_Frame extends javax.swing.JFrame {
19 |
20 | /**
21 | * Creates new form JAVADUINO_Frame
22 | */
23 |
24 | private static final String TURN_Amarillo_OFF="0";
25 | private static final String TURN_Amarillo_ON="1";
26 | private static final String TURN_Rojo_OFF="2";
27 | private static final String TURN_Rojo_ON="3";
28 |
29 | //Variables de conexión
30 | private OutputStream output=null;
31 | SerialPort serialPort;
32 | private final String PUERTO="/dev/ttyUSB0";
33 |
34 | private static final int TIMEOUT=2000; //Milisegundos
35 |
36 | private static final int DATA_RATE=9600;
37 |
38 |
39 | public JAVADUINO_Frame() {
40 | initComponents();
41 | inicializarConexion();
42 | jLabel1.setIcon(new ImageIcon("src/IconoLedRojoApagado.png"));
43 | jLabel3.setIcon(new ImageIcon("src/IconoLedAmarilloApagado.png"));
44 | setTitle("JAVADUINO");
45 | jRadioButton1.setSelected(true);
46 | }
47 |
48 | public void inicializarConexion(){
49 | CommPortIdentifier puertoID=null;
50 | Enumeration puertoEnum=CommPortIdentifier.getPortIdentifiers();
51 |
52 | while(puertoEnum.hasMoreElements()){
53 | CommPortIdentifier actualPuertoID=(CommPortIdentifier) puertoEnum.nextElement();
54 | if(PUERTO.equals(actualPuertoID.getName())){
55 | puertoID=actualPuertoID;
56 | break;
57 | }
58 | }
59 |
60 | if(puertoID==null){
61 | mostrarError("No se puede conectar al puerto");
62 | System.exit(ERROR);
63 | }
64 |
65 | try{
66 | serialPort = (SerialPort) puertoID.open(this.getClass().getName(), TIMEOUT);
67 | //Parámetros puerto serie
68 |
69 | serialPort.setSerialPortParams(DATA_RATE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
70 |
71 | output = serialPort.getOutputStream();
72 | } catch(Exception e){
73 | mostrarError(e.getMessage());
74 | System.exit(ERROR);
75 |
76 | }
77 | }
78 |
79 | private void enviarDatos(String datos){
80 | try{
81 | output.write(datos.getBytes());
82 | } catch(Exception e){
83 | mostrarError("ERROR");
84 | System.exit(ERROR);
85 | }
86 | }
87 |
88 | public void mostrarError(String mensaje){
89 | JOptionPane.showMessageDialog(this, mensaje, "ERROR", JOptionPane.ERROR_MESSAGE);
90 | }
91 |
92 |
93 |
94 | /**
95 | * This method is called from within the constructor to initialize the form.
96 | * WARNING: Do NOT modify this code. The content of this method is always
97 | * regenerated by the Form Editor.
98 | */
99 | @SuppressWarnings("unchecked")
100 | // //GEN-BEGIN:initComponents
101 | private void initComponents() {
102 |
103 | jButton1 = new javax.swing.JButton();
104 | jButton2 = new javax.swing.JButton();
105 | jLabel1 = new javax.swing.JLabel();
106 | jRadioButton1 = new javax.swing.JRadioButton();
107 | jRadioButton2 = new javax.swing.JRadioButton();
108 | jLabel3 = new javax.swing.JLabel();
109 |
110 | setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
111 |
112 | jButton1.setText("OFF");
113 | jButton1.addActionListener(new java.awt.event.ActionListener() {
114 | public void actionPerformed(java.awt.event.ActionEvent evt) {
115 | jButton1ActionPerformed(evt);
116 | }
117 | });
118 |
119 | jButton2.setText("ON ");
120 | jButton2.addActionListener(new java.awt.event.ActionListener() {
121 | public void actionPerformed(java.awt.event.ActionEvent evt) {
122 | jButton2ActionPerformed(evt);
123 | }
124 | });
125 |
126 | jLabel1.setText("jLabel1");
127 | jLabel1.setMaximumSize(new java.awt.Dimension(50, 50));
128 | jLabel1.setMinimumSize(new java.awt.Dimension(50, 50));
129 | jLabel1.setPreferredSize(new java.awt.Dimension(50, 50));
130 |
131 | jRadioButton1.setText("ROJO");
132 |
133 | jRadioButton2.setText("AMARILLO");
134 |
135 | jLabel3.setText("jLabel3");
136 | jLabel3.setMaximumSize(new java.awt.Dimension(50, 50));
137 | jLabel3.setMinimumSize(new java.awt.Dimension(50, 50));
138 | jLabel3.setPreferredSize(new java.awt.Dimension(50, 50));
139 |
140 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
141 | getContentPane().setLayout(layout);
142 | layout.setHorizontalGroup(
143 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
144 | .addGroup(layout.createSequentialGroup()
145 | .addContainerGap()
146 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
147 | .addGroup(layout.createSequentialGroup()
148 | .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
149 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
150 | .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
151 | .addGroup(layout.createSequentialGroup()
152 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
153 | .addComponent(jRadioButton1)
154 | .addComponent(jRadioButton2))
155 | .addGap(0, 0, Short.MAX_VALUE))
156 | .addGroup(layout.createSequentialGroup()
157 | .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
158 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
159 | .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, 72, Short.MAX_VALUE)))
160 | .addContainerGap())
161 | );
162 | layout.setVerticalGroup(
163 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
164 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
165 | .addContainerGap()
166 | .addComponent(jRadioButton1)
167 | .addGap(18, 18, 18)
168 | .addComponent(jRadioButton2)
169 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 63, Short.MAX_VALUE)
170 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
171 | .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
172 | .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
173 | .addGap(18, 18, 18)
174 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
175 | .addComponent(jButton1)
176 | .addComponent(jButton2))
177 | .addContainerGap())
178 | );
179 |
180 | pack();
181 | }// //GEN-END:initComponents
182 |
183 | private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
184 | // TODO add your handling code here:
185 | if(jRadioButton1.isSelected()){
186 | enviarDatos(TURN_Rojo_ON);
187 | jLabel1.setIcon(new ImageIcon("src/IconoLedRojo.png"));
188 | }
189 | if(jRadioButton2.isSelected()){
190 | enviarDatos(TURN_Amarillo_ON);
191 | jLabel3.setIcon(new ImageIcon("src/IconoLedAmarillo.png"));
192 | }
193 | }//GEN-LAST:event_jButton2ActionPerformed
194 |
195 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
196 | // TODO add your handling code here:
197 | if(jRadioButton1.isSelected()){
198 | enviarDatos(TURN_Rojo_OFF);
199 | jLabel1.setIcon(new ImageIcon("src/IconoLedRojoApagado.png"));
200 | }
201 | if(jRadioButton2.isSelected()){
202 | enviarDatos(TURN_Amarillo_OFF);
203 | jLabel3.setIcon(new ImageIcon("src/IconoLedAmarilloApagado.png"));
204 | }
205 | }//GEN-LAST:event_jButton1ActionPerformed
206 |
207 | /**
208 | * @param args the command line arguments
209 | */
210 | public static void main(String args[]) {
211 | /* Set the Nimbus look and feel */
212 | //
213 | /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
214 | * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
215 | */
216 | try {
217 | for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
218 | if ("Nimbus".equals(info.getName())) {
219 | javax.swing.UIManager.setLookAndFeel(info.getClassName());
220 | break;
221 | }
222 | }
223 | } catch (ClassNotFoundException ex) {
224 | java.util.logging.Logger.getLogger(JAVADUINO_Frame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
225 | } catch (InstantiationException ex) {
226 | java.util.logging.Logger.getLogger(JAVADUINO_Frame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
227 | } catch (IllegalAccessException ex) {
228 | java.util.logging.Logger.getLogger(JAVADUINO_Frame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
229 | } catch (javax.swing.UnsupportedLookAndFeelException ex) {
230 | java.util.logging.Logger.getLogger(JAVADUINO_Frame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
231 | }
232 | //
233 |
234 | /* Create and display the form */
235 | java.awt.EventQueue.invokeLater(new Runnable() {
236 | public void run() {
237 | new JAVADUINO_Frame().setVisible(true);
238 | }
239 | });
240 | }
241 | // Variables declaration - do not modify//GEN-BEGIN:variables
242 | private javax.swing.JButton jButton1;
243 | private javax.swing.JButton jButton2;
244 | private javax.swing.JLabel jLabel1;
245 | private javax.swing.JLabel jLabel3;
246 | private javax.swing.JRadioButton jRadioButton1;
247 | private javax.swing.JRadioButton jRadioButton2;
248 | // End of variables declaration//GEN-END:variables
249 | }
250 |
--------------------------------------------------------------------------------