Trying out my first app on a Photon-Help!

This is really frustrating! I have been programming in Basic for years…C++ is NOT BASIC!

you should post your code using Code Tags.

preface you code with back ticks like this:

```cpp

put your code in here

and put those at the end.

PS it looks like you have unmatched curly braces....

[quote="stephenscott, post:21, topic:32091"]
C++ is NOT BASIC!
[/quote]

thank God
1 Like

Here is the code after finding the bad bracket.

void setup() {
  pinMode(D6, INPUT_PULLDOWN); 
  pinMode(D5, INPUT_PULLDOWN); 
}

void loop() {
  if (digitalRead(D6)) {
    uint32_t ms = millis();
    Particle.publish("pizza test", "trig D6", PRIVATE);
    
 while (digitalRead(D6) || millis() - ms < 1000)
  }
  if (digitalRead(D5))
    uint32_t ms = millis();
    Particle.publish("pizza test", "trig D5", PRIVATE);
  
    while (digitalRead(D5) || millis() - ms < 1000);
      Particle.process();
  }

The error:
/workspace/pizza_4_29.cpp:18:42: error: ‘ms’ was not declared in this scope
}

Thanks for your help!

Try this instead (and observe the changed indentation which makes it easier to see what belongs where and where we are missing curly braces)

void setup() {
  pinMode(D6, INPUT_PULLDOWN); 
  pinMode(D5, INPUT_PULLDOWN); 
}

void loop() {
  uint32_t ms = millis();
  if (digitalRead(D6)) {
    Particle.publish("pizza test", "trig D6", PRIVATE);
    while (digitalRead(D6) || millis() - ms < 1000) Particle.process();
  }
  if (digitalRead(D5)) {
    Particle.publish("pizza test", "trig D5", PRIVATE);
    while (digitalRead(D5) || millis() - ms < 1000) Particle.process();
  }
}

You had some issues with a wrongly placed semicolon and several missing curly braces :wink:

2 Likes

Thank you! That worked like a charm! Now, to do some homework on learning C++

Thanks for the help @ScruffR!