B4R Question Arduino - how to do HTTPS curl?

IamTrying

Active Member
Licensed User
How to do HTTPS curl using B4R? Following code fails not working on my Arduino YUN boards.

B4X:
#include <Bridge.h>
#include <HttpClient.h>
// reset-mcu;reboot
String result = String("");
void setup() {
  delay(5000);
  pinMode(2, OUTPUT);
  Bridge.begin();
  digitalWrite(2, HIGH);
}

void loop() {
  HttpClient client;
  // PIN 2
  client.get("https://myserver.example.com/ajax/sppower?kiosk=001");
  result = "";
  while (client.available()) {
    char c = client.read();
    result = result + c;
  }
  if(result.indexOf("reboot") >= 0) {
    digitalWrite(2, LOW);
    delay(3000);
    digitalWrite(2, HIGH);
  }      
  delay(7000);
}
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…