- Az Xbox égisze alatt oldaná meg a PC-s játékosok legnagyobb gondját a Microsoft
- OLED TV topic
- Milyen billentyűzetet vegyek?
- Intel Core Ultra 3, Core Ultra 5, Ultra 7, Ultra 9 "Arrow Lake" LGA 1851
- Gaming notebook topik
- Kormányok / autós szimulátorok topikja
- Steam Deck
- Milyen Android TV boxot vegyek?
- ASRock lapok általában
- Azonnali alaplapos kérdések órája
-
PROHARDVER!
Arduino hardverrel és szoftverrel foglakozó téma. Minden mikrovezérlő ami arduinoval programozható, és minden arduino program, board, és hardverrel kapcsolatos kérdések helye.
Új hozzászólás Aktív témák
-
válasz
Wolfram #19320 üzenetére
Esetleg ezzel tegyél egy próbát, nem teszteltem, csak hogy fordul-e.
#include <HTTPClient.h>
class customHTTPClient : public HTTPClient
{
public:
using HTTPClient::GET;
String GET(const String &url)
{
String result;
if(begin(url))
{
if(GET() > 0)
{
result = getString();
}
end();
}
return result;
}
};
void setup()
{
customHTTPClient http;
String result = http.GET("http://www.test.com");
} -
Janos250
őstag
válasz
Wolfram #19320 üzenetére
Nincs ez elbonyolítva.
Hirtelenjében ezt hoztam össze.
Ha erre gondoltál használd, ha nem, majd valakinek valamire hátha jó lesz.#define __cplusplus 201103L
#include <WiFi.h>
#include <WiFiClient.h>
#include <string>
#include <iostream>
#include <fstream> // ofstream
#include <stdio.h>
using namespace std;
#define remoteServerPort 80
//const char* ssid = "*********";
//const char* password = "*********";
uint8_t ServerIPlocal[] {192,168,0,30} ;
uint8_t gatewayIPlocal[] {192,168,0,1} ;
uint8_t subnetIPlocal[] {255,255,255,0} ;
WiFiServer remoteServer (remoteServerPort );
WiFiClient remoteServerClient ;
void setup() {
delay(1000);
Serial.begin(115200) ;
delay(1000);
WiFi.begin(ssid, password );
delay(2000);
WiFi.config(ServerIPlocal, gatewayIPlocal, subnetIPlocal) ;
WiFi.setAutoReconnect(true);
delay(2000);
printf("\nConnecting to %s \n",ssid);
uint8_t i = 0;
while (WiFi.status() != WL_CONNECTED && i++ < 20){
printf(".");
delay(500);
}
if(i == 21){
printf("\nCould not connect to \n",ssid);
while(1) delay(500);
} ;
string strMyURL = "http://"+
to_string(WiFi.localIP()[0])+"."+
to_string(WiFi.localIP()[1])+"."+
to_string(WiFi.localIP()[2])+"."+
to_string(WiFi.localIP()[3])+":"+
to_string(remoteServerPort)
;
printf("My URL: %s \n",strMyURL.c_str() );
uint8_t ip[]{192,168,0,33};
String valasz = httpGet((IPAddress)ip) ;
Serial.println(); Serial.println(); Serial.println(); Serial.println();
Serial.println("ez a valasz:");
Serial.println(valasz);
} // end setup
void loop() {
} ; // end loop
String httpGet(IPAddress ip){
const char GET_HTTP[] PROGMEM = R"=====(
GET / HTTP/1.1
)=====";
uint16_t idozites ;
String reply ;
WiFiClient remoteServerClient ;
if (!remoteServerClient.connect(ip,80)){
return "no connect";
Serial.println ("connect hiba");
} ;
// Serial.println ("connected");
remoteServerClient.println(GET_HTTP);
idozites = 0 ;
reply = "" ;
while (
remoteServerClient.available() ||
(idozites++ < 500)
) // rxBuffer->available()
{
if (remoteServerClient.available()){
char c=remoteServerClient.read();
idozites = 0 ;
reply += c ;
// printf("%c",c);
}
else{
delay(1);
}; // if (remoteServerClient.available())
} ; // end while (remoteServerClient.available())
// printf("\n");
remoteServerClient.stop(); // _rxBuffer = NULL; _connected = false;
// Serial.println();Serial.println();Serial.println();Serial.println();
// Serial.println("Ez a string");
// Serial.println(reply);
return reply ;
};
-
Új hozzászólás Aktív témák
- Az Xbox égisze alatt oldaná meg a PC-s játékosok legnagyobb gondját a Microsoft
- Luck Dragon: Asszociációs játék. :)
- OLED TV topic
- Hardcore café
- Milyen billentyűzetet vegyek?
- Intel Core Ultra 3, Core Ultra 5, Ultra 7, Ultra 9 "Arrow Lake" LGA 1851
- Gaming notebook topik
- Elektromos autók - motorok
- Kormányok / autós szimulátorok topikja
- GoodSpeed: AOMEI Backupper Professional Edition: Lifetime Subscription
- További aktív témák...
- EK-Quantum Velocity RGB - Full Nickel - LGA1700-hoz is!
- Újszerű Creality K1 MAX + CFS garanciális, nyomtatótér: 300 x 300 x 300 mm 160 óra üzemidő
- Extrém teljesítményű gamer PC (AMD Ryzen 7 5700X, Radeon RX 7900 XTX) LEGJOBB ÁR/ÉRTÉK ARÁNY!
- Garanciális Gamer Számítógép, PC (RTX 3060Ti, I5-10400, 16GB Ram, SSD) Beszámítás! Posta ok! (37)
- Garanciális Gamer Számítógép, PC (GTX 1070 8GB, I3-10105, 16GB Ram, SSD) Beszámítás! Posta ok! (36)
- iKing.Hu - Vivo X200 FE Blue Használt, újszerű állapotban 12 GB RAM / 256 GB tárhely Garancia!
- Telefon felvásárlás!! Apple Watch Series 9/Apple Watch Ultra/Apple Watch Ultra 2
- Telefon felvásárlás!! iPhone 14/iPhone 14 Plus/iPhone 14 Pro/iPhone 14 Pro Max
- Bomba ár! Dell Latitude 7390 - i5-8GEN I 8GB I 256GB SSD I 13,3" FHD I HDMI I Cam I W11 I Gari!
- GYÖNYÖRŰ iPhone 13 256GB Starlight -1 ÉV GARANCIA - Kártyafüggetlen, MS3204, 94% Akkumulátor
Állásajánlatok
Cég: FOTC
Város: Budapest