Oi, this website is currently on the move to https://turboflip.de - party on there!

ESP32 BLE to p5.js UPDATE

todo: floating values do not work!!!!


#include <BleGamepad.h> 
 BleGamepad bleGamepad("LEONARD_ONE", "bubu Studios",49);

void setup() 
{
  Serial.begin(115200);
  Serial.println("Starting BLE work!");
  bleGamepad.begin();
  
}

void loop() 
{
  if(bleGamepad.isConnected()) 
  {
    Serial.println("Press buttons 5 and 16. Move all enabled axes to max. Set DPAD (hat 1) to down right.");


     int one = int(map( (sin(millis()*.001)+1),0,2,0,32767.*2.));
      int two = int(map( (sin(millis()*.003)+1),0,2,0,32767.*2.));
      int tree = int(map( (sin(millis()*.005)+1),0,2,0,32767.*2.));

      bleGamepad.setX(one);
      bleGamepad.setY(two);
      bleGamepad.setZ(tree);


        bleGamepad.sendReport();

    delay(50);
  }
}

https://editor.p5js.org/simon_oakey/sketches/OpJBV6f5I