I posted this before but I thought I should post this again properly.
Someone please help me.
what I am trying to do:
- have two outputs through Arduino (LCD, LED)
What I have:
- using Visual Studio 2015, using C# right now
from visual studio, i have two buttons, and 1 text box (please see attachment for an image)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Arduino_Connection
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
serialPort1.Open();
}
private void button1_Click(object sender, EventArgs e)
{
serialPort1.Write("A");
}
private void button2_Click(object sender, EventArgs e)
{
serialPort1.Write("j");
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
}
}
I have not wrote down anything for the text box portion yet. Because i do not know if i can use same serialPort to send a data to Arduino when Arduino is reading from the same Serial
int data;
void setup() {
Serial.begin(9600);
pinMode(13, OUTPUT);
}
void loop()
{
if (Serial.available())
{
data = Serial.read();
if (data == 'A')
{
digitalWrite(13,HIGH);
}
else
{
digitalWrite(13,LOW);
}
}
}
so, basically i have the LED worked out. but if i were to have a text msg box work out using the visual studio with Arduino... how do i do that...?
Is there any way i can distinguish the data that i am trying to use from visual studio to arduino?
PLEASE HELP!!!
Thank you so much in advance!!