-
-
Save dj1711572002/b9eb3d6a9813f1efd23d761fe741311d to your computer and use it in GitHub Desktop.
WiFiUDP ESP32 TestPgm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Test sketch for Adafruit BNO08x sensor in UART-RVC mode */ | |
//#include "Adafruit_BNO08x_RVC.h" | |
//Adafruit_BNO08x_RVC rvc = Adafruit_BNO08x_RVC(); | |
//--------------------------------Version histroy------------------------------------------------------------- | |
//rev01:イレギュラーデータを検出する機能、BNOのデータ配列を120個に拡張 | |
//rev02:F9Pの受信データが細切れで頭がでたらめで入力される場合多発したので、ヘッダー検索してから読み込む機能追加2024/1/6 | |
//------------------------------------------------------------------------------------------------------------- | |
#include <WiFi.h> | |
#include <WiFiUdp.h> | |
const char ssid[] = "your ssid"; // SSID | |
const char pass[] = "your pass"; // password | |
//Wifi set up | |
static WiFiUDP wifiUdp; | |
static const char *kRemoteIpadr = "192.168.0.109";//送信先PCのIPアドレス 同じポケットWiFiに接続のこと | |
static const int kRmoteUdpPort = 10000; //送信先のポート | |
static byte c[120];//12byte x10times 100msec(10msecx10data) | |
char b0,b1,b2; | |
static uint8_t f9pdata[172]; | |
static uint8_t bnodata[172]; | |
static int bnoitow[10]; | |
static unsigned int itow,itow0; | |
uint8_t head[4]; | |
uint8_t irgdata[100]; | |
static int tp,sn,tpflag; | |
int i,n,m; | |
int tt,tin,t0,t1,t2,t3; | |
//=============================================== | |
static void WiFi_setup() | |
{ | |
static const int kLocalPort = 5000; //自身のポート | |
WiFi.begin(ssid, pass); | |
while( WiFi.status() != WL_CONNECTED) { | |
delay(500); | |
} | |
Serial.print("myIP="); | |
Serial.println(WiFi.localIP()); | |
wifiUdp.begin(kLocalPort); | |
} | |
//================================================= | |
void setup() { | |
// Wait for serial monitor to open | |
Serial.begin(115200); | |
WiFi_setup(); | |
}//set up end | |
void loop() | |
{ | |
for(i=0;i<172;i++){ | |
f9pdata[i]=i; | |
} | |
t2=micros(); | |
wifiUdp.beginPacket(kRemoteIpadr, kRmoteUdpPort); | |
wifiUdp.write(f9pdata,172); //送信される | |
wifiUdp.endPacket(); | |
delay(10); | |
t3=micros(); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment