Winform that I made can't receive datas from Arduino Uno R4 wifi. It works well when I used Arduino Nano.
This is arduino sketch :
#include<stdio.h>
char inp[10];
void setup() {
Serial.begin(115200);
}
void loop() {
if (Serial.available()>0) {
int i = 0;
//inp = Serial.read();
for (i=0; i<10; i++) {
inp[i] = Serial.read();
delayMicroseconds(80);
}
if (inp[0] == 'S') {
Serial.println("Hello");
}
}
}
and below is for winform :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO.Ports;
namespace _230801_test2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
serialPort1.Open();
}
private void button2_Click(object sender, EventArgs e)
{
serialPort1.Write("S");
Debug.WriteLine("S");
string data = serialPort1.ReadLine();
Debug.WriteLine(data);
richTextBox1.Text += data;
}
}
}