Things used in this project

Hardware components:
09590 01
LED (generic)
×1
DFRobot LattePanda
×1
A000066 iso both
Arduino UNO & Genuino UNO
×1
Lp rglvzbedym
LattePanda 2GB/32GB (Unactivated)
×1
Software apps and online services:
Vs2015logo
Microsoft Visual Studio 2015
Ide web
Arduino IDE

Code

Code snippet #1Plain text
public partial class Form1 : Form    {
        SerialPort port;        public Form1()
        {
            InitializeComponent();            this.FormClosed += new FormClosedEventHandler(Form1_FormClosed);            if (port == null)
            {
                //Change the portname according to your computer
                port = new SerialPort("COM4", 9600);
                port.Open();
            }
        }void Form1_FormClosed(object sender, FormClosedEventArgs e)        {
            if (port != null && port.IsOpen)
            {
                port.Close();
            }
        }private void button1_Click(object sender, EventArgs e)        {
            
                PortWrite("1");
            
        }        
        private void button2_Click(object sender, EventArgs e)
        {
           
                PortWrite("0");
            
        }private void PortWrite(string message)        {
            if (port != null && port.IsOpen)
            {
                port.Write(message);
            }
        }
    }
Code snippet #2Plain text
const int LedPin = 3;int ledState = 0;void setup()
{ 
  pinMode(LedPin, OUTPUT);
  
  Serial.begin(9600);  
}void loop()
{ 
    char receiveVal;   
   
    if(Serial.available() > 0)
    {        
        receiveVal = Serial.read();
        
       if(receiveVal == '1')    
          ledState = 1;   
       else
          ledState = 0;     
    }   
      
    digitalWrite(LedPin, ledState); 
      
    delay(50);    
}

Credits

Img 4181 f2gqobidmh
Haoming Weng
4 projects • 12 followers
A graduated student
Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Add projectSign up / Login