2012-11-16 3 views
0

나는 Arduino uno에게 수업을 보내기위한 시각적 인 스튜디오 프로그램을 가지고 있습니다. 하지만 컴파일하려고하면 다음과 같은 오류가 발생합니다.Visual Studio 2008의 Arduino uno

"WithEvents variable 'SerialPort1' implicitly defines >'_SerialPort1', which conflicts with a member of the same name in class 'Form1'. C:\Users\*****\Desktop\WindowsApplication1\WindowsApplication1\Form1.Designer.vb 77 
" 

이 문제를 해결할 수있는 사람이 있습니까?

Imports System.IO 
Imports System.IO.Ports 
Imports System.Threading 

Public Class Form1 
    Shared _continue As Boolean 
    Shared _serialPort1 As SerialPort 


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 
     SerialPort1.Close() 
     SerialPort1.PortName = "com31" 'change com port to match your Arduino port 
     SerialPort1.BaudRate = 9600 
     SerialPort1.DataBits = 8 
     SerialPort1.Parity = Parity.None 
     SerialPort1.StopBits = StopBits.One 
     SerialPort1.Handshake = Handshake.None 
     SerialPort1.Encoding = System.Text.Encoding.Default 'very important! 
    End Sub 



    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 
     SerialPort1.Open() 
     SerialPort1.Write("1") 
     SerialPort1.Close() 
    End Sub 


    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click 
     SerialPort1.Open() 
     SerialPort1.Write("0") 
     SerialPort1.Close() 
    End Sub 
End Class 

답변

1

아래 줄의 변수 이름이 상충되는 것 같습니다.

Shared _serialPort1 As SerialPort 

변수의 이름을 변경하십시오.