Foros del Web » Programación para mayores de 30 ;) » Java »

no ejecuta programa con arduino y jfreechart

Estas en el tema de no ejecuta programa con arduino y jfreechart en el foro de Java en Foros del Web. buenas tardes compañeros. segui un tutorial de visualizar la data de arduino en java en netbeans,,corregi todos los errores pero no me ejecuta nada Les ...
  #1 (permalink)  
Antiguo 06/12/2013, 13:55
 
Fecha de Ingreso: diciembre-2013
Mensajes: 1
Antigüedad: 10 años, 4 meses
Puntos: 0
no ejecuta programa con arduino y jfreechart

buenas tardes compañeros. segui un tutorial de visualizar la data de arduino en java en netbeans,,corregi todos los errores pero no me ejecuta nada

Les paso el codigo

Código:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package charts;

import Arduino.Arduino;
import gnu.io.SerialPortEvent;
import gnu.io.SerialPortEventListener;
import java.awt.Window;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.Grafica;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;



/**
 *
 * @author Milovan
 */
public class Timer555 extends javax.swing.JFrame {

    Arduino Arduino = new Arduino();
    SerialPortEventListener evento;
    private JFreeChart Grafica;
//    private JFreeChart Graphic;
    
    public Timer555() {
        this.evento = new SerialPortEventListener () {
            public void serialEvent(SerialPortEvent spe){
                
            }
        };
        initComponents();
    
        try {
        Arduino.ArduinoRX("COM20", 2000, 9600, evento);
    } catch (Exception ex){
        Logger.getLogger(Window.class.getName()).log(Level.SEVERE,null, ex);
    }
    final XYSeries Serie = new XYSeries("Timer555");
    final XYSeriesCollection Coleccion = new XYSeriesCollection();
     JFreeChart Grafica;
    
        Serie.add(0,0);
             Coleccion.addSeries(Serie);
             Grafica = ChartFactory.createXYLineChart("Voltaje vs Frecuencia", "Voltaje", "Frecuencia", Coleccion,
                     PlotOrientation.VERTICAL, true, true, false);
     
    }    
              
             
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {

        jButton1 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jButton1.setText("Grafica");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(148, 148, 148)
                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(126, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(104, 104, 104)
                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(156, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>                        

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
ChartPanel Panel = new ChartPanel(Grafica);
JFrame Ventana = new JFrame("JFreeChart");
Ventana.getContentPane().add(Panel);
Ventana.pack();
Ventana.setVisible(true);
Ventana.setDefaultCloseOperation(JFtame.EXIT_ON_CLOSE);
    }                                        

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Timer555.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Timer555.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Timer555.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Timer555.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Timer555().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify                     
    private javax.swing.JButton jButton1;
    // End of variables declaration                   
}
Mi problema es en:

Código:
JFreeChart Grafica;
    
        Serie.add(0,0);
             Coleccion.addSeries(Serie);
             Grafica = ChartFactory.createXYLineChart("Voltaje vs Frecuencia", "Voltaje", "Frecuencia", Coleccion,
                     PlotOrientation.VERTICAL, true, true, false);
que queda sin ningun cambio en el compilador.

que es lo que le puede pasar??

Esperando su gran ayuda.

Gracias


PD: El tutorial lo saque de:

http://panamahitek.com/graficas-de-sensores-en-tiempo-real-con-arduino-java-y-jfreechart/

Etiquetas: ejecuta, html, jfreechart, netbeans, programa, string
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 06:30.