Skip to content

Commit

Permalink
Update LaunchRandomExample.ino
Browse files Browse the repository at this point in the history
  • Loading branch information
v1605 authored Nov 17, 2024
1 parent b328043 commit 34f2956
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions examples/LaunchRandomExample.ino
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
#include <Arduino.h>
#include <WiFi.h>
#include "TapToLaunchApi.h"
#include "ZaparooLaunchApi.h"

//Config (Update before compile)--------------------------------------------------
const char* ssid = "WifiName";
const char* password = "WifiPassword";
const String tapToUrl = "ws://tapToIp:7497";
const String zaparooUrl = "ws://tapToIp:7497";
//EndConfig-----------------------------------------------------------------------

TapToLaunchApi client(tapToUrl);
ZaparooLaunchApi client;
bool launched = false;

void setup() {
Serial.begin(115200);
client.url(zaparooUrl);
initWiFi();
while (!Serial) {
delay(200);
Expand All @@ -21,10 +22,12 @@ void setup() {

void loop() {
if(!launched){
int code = client.launch("**launch.random:snes,nes");
String result = "";
result = result + "**launch.random:snes,nes";
int code = client.launch(result);
launched = code == 0;
if(launched){
Serial.println("Launched TapTo");
Serial.println("Launched Zaparoo");
}else{
Serial.print("Error code ");
Serial.println(code);
Expand All @@ -43,4 +46,4 @@ void initWiFi() {
delay(500);
}
Serial.println(WiFi.localIP());
}
}

0 comments on commit 34f2956

Please sign in to comment.