ESP-01 Modul mit PFOD steuern... ACCESSPOINT

SefanH

Active member
Ich möchte gerne eine LED mit einem Programm aus dem PFOD-Designer ein und ausschalten.
Ich bekomme es jedoch nicht hin einen Accesspoint zu erstellen und dort dann die Verbindung mit PFOD herzustellen...
Kann mir da jemand helfen? Der PFOD-Designer hat folgendes ausgegeben:
Code:
/* ===== pfod Command for Menu_2 ====
pfodApp msg {.} --> {,~<prompt not set>`0~V4|B~Buttontext|C~Button|A`0~PWM Setting ~%`255`0~100~0~}
 */
// Using Serial and 9600 baud for send and receive
// Serial D0 (RX) and D1 (TX) on Arduino Uno, Micro, ProMicro, Due, Mega, Mini, Nano, Pro and Ethernet
// This code uses Serial so remove shield when programming the board
/* Code generated by pfodDesignerV3 V3.0.3871
 */
/*
 * (c)2014-2021 Forward Computing and Control Pty. Ltd.
 * NSW Australia, www.forward.com.au
 * This code is not warranted to be fit for any purpose. You may only use it at your own risk.
 * This generated code may be freely used for both private and commercial use
 * provided this copyright is maintained.
 */

// download the libraries from http://www.forward.com.au/pfod/pfodParserLibraries/index.html
// pfodParser.zip V3.51+ contains pfodParser, pfodSecurity, pfodDelay, pfodBLEBufferedSerial, pfodSMS and pfodRadio
#include <pfodParser.h>

int swap01(int); // method prototype for slider end swaps

pfodParser parser("V5"); // create a parser to handle the pfod messages
int cmd_A_var; // name the variable for 'PWM Setting'

unsigned long plot_mSOffset = 0; // set by {@} response
bool clearPlot = false; // set by the {@} response code

// the setup routine runs once on reset:
void setup() {
  Serial.begin(9600);
  for (int i=3; i>0; i--) {
    // wait a few secs to see if we are being programmed
    delay(1000);
  }
  parser.connect(&Serial); // connect the parser to the i/o stream


  // <<<<<<<<< Your extra setup code goes here
}

// the loop routine runs over and over again forever:
void loop() {
  uint8_t cmd = parser.parse(); // parse incoming data from connection
  // parser returns non-zero when a pfod command is fully parsed
  if (cmd != 0) { // have parsed a complete msg { to }
    uint8_t* pfodFirstArg = parser.getFirstArg(); // may point to \0 if no arguments in this msg.
    pfod_MAYBE_UNUSED(pfodFirstArg); // may not be used, just suppress warning
    long pfodLongRtn; // used for parsing long return arguments, if any
    pfod_MAYBE_UNUSED(pfodLongRtn); // may not be used, just suppress warning
    if ('.' == cmd) {
      // pfodApp has connected and sent {.} , it is asking for the main menu
      if (!parser.isRefresh()) {
        sendMainMenu(); // send back the menu designed
      } else {
        sendMainMenuUpdate(); // menu is cached just send update
      }

      // handle {@} request
    } else if('@'==cmd) { // pfodApp requested 'current' time
      plot_mSOffset = millis(); // capture current millis as offset rawdata timestamps
      clearPlot = true; // clear plot on reconnect as have new plot_mSOffset
      parser.print(F("{@`0}")); // return `0 as 'current' raw data milliseconds
    

    // now handle commands returned from button/sliders
    } else if('B'==cmd) { // user pressed -- 'Buttontext'
      // in the main Menu of Menu_2
      // << add your action code here for this button
      parser.print(F("{}")); // change this return as needed.
       // always send back a pfod msg otherwise pfodApp will disconnect.

    } else if('C'==cmd) { // user pressed -- 'Button'
      // in the main Menu of Menu_2
      // << add your action code here for this button
      parser.print(F("{}")); // change this return as needed.
       // always send back a pfod msg otherwise pfodApp will disconnect.

    } else if('A'==cmd) { // user moved PWM slider -- 'PWM Setting'
      // in the main Menu of Menu_2
      parser.parseLong(pfodFirstArg,&pfodLongRtn); // parse first arg as a long
      cmd_A_var = (int)pfodLongRtn; // set variable
      sendMainMenuUpdate(); // always send back a pfod msg otherwise pfodApp will disconnect.

    } else if ('!' == cmd) {
      // CloseConnection command
      closeConnection(parser.getPfodAppStream());
    } else {
      // unknown command
      parser.print(F("{}")); // always send back a pfod msg otherwise pfodApp will disconnect.
    }
  }
  //  <<<<<<<<<<<  Your other loop() code goes here
 
}

void closeConnection(Stream *io) {
  // add any special code here to force connection to be dropped
}

void sendMainMenu() {
  // !! Remember to change the parser version string
  //    every time you edit this method
  parser.print(F("{,"));  // start a Menu screen pfod message
  // send menu background, format, prompt, refresh and version
  parser.print(F("~<prompt not set>`0"));
  parser.sendVersion(); // send the menu version
  // send menu items
  parser.print(F("|B"));
  parser.print(F("~Buttontext"));
  parser.print(F("|C"));
  parser.print(F("~Button"));
  parser.print(F("|A"));
  parser.print('`');
  parser.print(cmd_A_var); // output the current value
  parser.print(F("~PWM Setting ~%`255`0~100~0~"));
  parser.print(F("}"));  // close pfod message
}

void sendMainMenuUpdate() {
  parser.print(F("{;"));  // start an Update Menu pfod message
  // send menu items
  parser.print(F("|B"));
  parser.print(F("|C"));
  parser.print(F("|A"));
  parser.print('`');
  parser.print(cmd_A_var); // output the current value
  parser.print(F("}"));  // close pfod message
  // ============ end of menu ===========
}

int swap01(int in) {
  return (in==0)?1:0;
}
// ============= end generated code =========
 

// pfodApp V3.0.3871,local time,UTC,mS per day,pfodDesignerV3 current time(mS),pfodDesignerV3 current time,
// connected at,2021/05/24 13:48:08.961,2021/05/24 11:48:08.961,86400000,0,2021/05/24 11:48:08.939


Ich bin hier ziemlich überfordert wie es scheint...
 
Hi,
Ich verstehe jetzt nicht ganz was du möchtest.

Auf welcher Platform willst du was machen ?

Möchtest du über einen esp eine Led steuern ?

Vg Thorsten
 
Ja, ich möchte einen Neopixel-Streifen mit einem ESP-01 Modul ansteuern.
Ich habe gestern gemerkt dass der generierte Code vom Pfod-Designer nicht der beabsichtigte Code war... Die App läuft nicht auf Android 11. Die App kann keine Daten speichern. Ich habe sofort Kontakt zum Hersteller aufgenommen und auch schon funktionierende Testversionen bekommen.

Somit komme ich jetzt wieder gut klar!
 
So wie es aussieht komme ich mit meinem 1MB nicht mit WLED klar! Ist nicht ohne größere Eingriffe für ESP-01 Module nutzbar!
 
doch das geht irgendwie ...

kann dir aber aus dem kopf nicht mehr sagen wie.

ich meine da gabs extra eine version für den 01er

vg
Thorsten
 
Oben