Things used in this project

Hardware components:
Ardgen 101
Arduino 101 & Genuino 101
×1
A000066 iso both
Arduino UNO & Genuino UNO
×1
 dsc1102 900x600
DFRobot Romeo BLE - Arduino Robot Control Board with Bluetooth 4.0
×1
Arduino Leonardo
×1
1 450x300 37m391smlh
LattePanda 7-inch 1024 x 600 IPS Display
×1
Lp rglvzbedym
LattePanda 2GB/32GB (Unactivated)
×1
Software apps and online services:
Ide web
Arduino IDE
Vs2015logo
Microsoft Visual Studio 2015

Code

LattePanda—>ArduinoArduino
Communicate From the LattePanda CPU to the Arduino. (Arduino Sketch)
const int LedPin = 13;  
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(5000);      
}
LattePanda—>ArduinoC#
Communicate From the LattePanda CPU to the Arduino. (C# Sketch,WinformsApp)
using System;
using System.Windows.Forms;
using System.IO.Ports;
namespace lightcontrol
{
    public partial class Form1 : Form
    {
        SerialPort port;
        public Form1()
        {
            InitializeComponent();Q
            this.FormClosed += new FormClosedEventHandler(Form1_FormClosed);
            if (port==null)
            {
                port = new SerialPort("COM7", 9600);//Set your board COM
                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)
        {
            port.Write(message);
        }
    }
}
Arduino—>LattePandaArduino
Communicate from the Arduino to the LattePanda CPU. (Arduino Sketch)
void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
Serial.print('1');
delay(200);
}
Arduino—>LattePandaC#
Communicate from the Arduino to the LattePanda CPU. (C# Sketch)
using System;
using System.IO.Ports;
using System.Threading;
namespace ConsoleApp1
{
    class Program
    {
        static SerialPort _serialPort;
        public static void Main()
        {
            _serialPort = new SerialPort();
            _serialPort.PortName = "COM4";//Set your board COM
            _serialPort.BaudRate = 9600;
            _serialPort.Open();
            while (true)
            {
                string a = _serialPort.ReadExisting();
                Console.WriteLine(a);
                Thread.Sleep(200);
            }
        }
    }
}

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