/* Test of the variable transfer from a smartphone (P) to Arduino (A). It supposed to happen only when the corresponding value is changed in the smartphone phyphox. The P to A communication is manifested by blinking of the builtin led. */ #include float myFloatArduino; // variable to be received void setup() { // put your setup code here, to run once: PhyphoxBLE::start(); //Start the BLE server // Initialize the variable transfer when the corresponding // value is changed in the smartphone phyphox PhyphoxBLE::configHandler = &PtoAcommunication; // !! // initialize digital pin LED_BUILTIN as an output. pinMode(LED_BUILTIN, OUTPUT); Serial.begin(9600); // blocks the program untill opening of the Serial Monitor. while (!Serial); } // end setup void loop() { // put your main code here, to run repeatedly: delay(2000); // Serial.print("myFloat = "); // Serial.println(myFloatArduino); } void PtoAcommunication(){ int i; for(i=0; i<5; i++) { digitalWrite(LED_BUILTIN, HIGH); delay(100); digitalWrite(LED_BUILTIN, LOW); delay(300); } PhyphoxBLE::read(myFloatArduino); Serial.print("myFloat = "); Serial.println(myFloatArduino); /* Printing and blinking all the time even when * the value is not changed in the smartphone !!??? */ }