Created
March 16, 2015 20:48
-
-
Save yakutozcan/a930338dca362d55cca2 to your computer and use it in GitHub Desktop.
JavaLed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Form açıldığında seri bağlantıyı kuracaktır | |
private void formWindowOpened(java.awt.event.WindowEvent evt) { | |
try { | |
seri.openPort(); // Portu Aç | |
} catch (SerialPortException ex) { | |
Logger.getLogger(AnaEkran.class.getName()).log(Level.SEVERE, null, ex); | |
} | |
try { | |
seri.setParams(9600, 8, 1,0); // 9600 Baud, 8 bit veri, 1 bit stop biti, Parity biti (*********) | |
} catch (SerialPortException ex) { | |
Logger.getLogger(AnaEkran.class.getName()).log(Level.SEVERE, null, ex); | |
} | |
} | |
//Ledi yakmak için Jbutton kodları | |
private void LedYakActionPerformed(java.awt.event.ActionEvent evt) { | |
try { | |
seri.writeInt(1); //Seri Porttan 1 değerinde veri gönder. | |
} catch (SerialPortException ex) { | |
Logger.getLogger(AnaEkran.class.getName()).log(Level.SEVERE, null, ex); | |
} | |
// Ledi söndürmek için Jbutton kodları | |
private void LedSondurActionPerformed(java.awt.event.ActionEvent evt) { | |
try { | |
seri.writeInt(0); //Seri Porttan 0 değerinde veri gönder. | |
} catch (SerialPortException ex) { | |
Logger.getLogger(AnaEkran.class.getName()).log(Level.SEVERE, null, ex); | |
} | |
// Seriportu kapatmak için Jbutton kodları | |
private void SeriPortKapatActionPerformed(java.awt.event.ActionEvent evt) { | |
try { | |
seri.closePort(); // Portu Kapat | |
SPDurumLBL.setText("Seriport Durum: Kapalı"); | |
} catch (SerialPortException ex) { | |
Logger.getLogger(AnaEkran.class.getName()).log(Level.SEVERE, null, ex); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment