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 don't cross-post. Your thread title of "PLEASE HELP ME QUICK!!!" is appallingly bad. Most people will just move on. Post what you are trying to do, not "help me quick".
What i am trying to do is having 2 seperate user inputs (message box & on/off switch) from user interface (VS) and output it to arduino lcd screen and led.
For example, user can type "potato fries" and indicate if the cooking machine is on or off.
You have successfully demonstrated that from C# running on your PC, you can activate a button and transmit the results through the serial port right through to the Arduino where you can interpret the data stream and activate a LED. Is that correct ?
Why not simply code the message box and attempt to send a value to the Arduino using the same construct ie serialPort1.Write("xxxxxxxxxxxxxxxxx");
On the Arduino, then start by simply printing out what you have read on the serial port. Once you see what you get, work out how you can parse it (and distinguish it from the data for the 'button press')
Hi, I have one question.
How I can get action from button on arduino in my visual studio C# windows form app?
I used StandardFirmata for communicate with arduino, but I can not get action when I press button on arduino.