Frustration in getting started

Can you paste your full code here

Which LED are you referring to? Is your code trying to blink the led on D7 ?
I assume you are initally testing with simple code, like blink led on D7.

Here you are:

//SYSTEM_MODE(MANUAL);

int flag = 0;

unsigned long tLapse = 0;
unsigned long tLapse2 = 0;
unsigned long tLapse3 = 0;

IPAddress myremoteAddr2(192, 168, 43, 95);
int myremotePortNumber2 = 9000;


unsigned int localPort = 8000;

unsigned int loopy = 0;
unsigned int loopy2 = 0;
unsigned int cnt = 10;

UDP myUDP;

char outbuffer[7] = "hello";
char outbuffer2[6] = "panic";

 #define inbufsize   50

char inbuffer[inbufsize];

unsigned int ptrRead = 0;
unsigned int ptrWrite = 0;

volatile unsigned int inputCount = 0;

void setup() {
    
    myUDP.begin(localPort);
    
    pinMode(D7, OUTPUT);
    Serial1.begin(9600);
    
     tLapse = millis();
     tLapse2 = millis();
     tLapse3 = millis();
     
     Serial.begin(9600);

}

void loop() {

 //digitalWrite(D7, HIGH);
 //delay(5000);
// digitalWrite(D7, LOW);
// delay(5000);
    if (millis() - tLapse3 >= 6000)
    {
        tLapse3 = millis();
      // IPAddress myremoteAddr2 = myUDP.remoteIP();
       //int myremotePortNumber2 = 9000;
        
        //send
       myUDP.beginPacket(myremoteAddr2, myremotePortNumber2);
        
        
        for (loopy2 = 0; loopy2 < 6; loopy2++)
        {
            myUDP.write(outbuffer2[loopy2]);
        }
       // myUDP.write(outbuffer, 7);
        myUDP.endPacket();        
    }


    if (myUDP.parsePacket() > 0)
    {
        while (myUDP.read())
        {
            inbuffer[ptrWrite] = myUDP.read();
            
            ++inputCount;
            
            if (++ptrWrite >= inbufsize)
            {
                ptrWrite = 0;
            }
        }
        
       IPAddress myremoteAddr = myUDP.remoteIP();
       int myremotePortNumber = myUDP.remotePort();
        
        //send
       myUDP.beginPacket(myremoteAddr, myremotePortNumber);
        myUDP.write(inbuffer[ptrRead]);
        
        for (loopy = 0; loopy < 7; loopy++)
        {
            myUDP.write(outbuffer[loopy]);
        }
       // myUDP.write(outbuffer, 7);
        myUDP.endPacket();
    }

    if (millis() - tLapse2 >= 10000)
    {
        tLapse2 = millis();
        
        Serial1.println(WiFi.localIP());
    }
    
    if ((inputCount > 0) && (ptrRead != ptrWrite))
    {
        if (inbuffer[ptrRead] == 'N')
        {
            digitalWrite(D7, HIGH);
            --inputCount;
            
            if (++ptrRead >= inbufsize)
            {
                ptrRead = 0;
            }
        }
        else if (inbuffer[ptrRead] == 'F')
        {
            digitalWrite(D7, LOW);
            --inputCount;
            
            if (++ptrRead >= inbufsize)
            {
                ptrRead = 0;
            }
        }
        else
        {
            --inputCount;
            
            if (++ptrRead >= inbufsize)
            {
                ptrRead = 0;
            }
        }
    }    

 
 if (millis() - tLapse >= 3000)
 {
     if (cnt > 0)
     {
        tLapse = millis();
        --cnt;
        if (flag == 0)
        {
            flag = 1;
            digitalWrite(D7, HIGH);
            Serial1.println("HIGH");
         
        }
        else
        {
            flag = 0;
            digitalWrite(D7, LOW);
            Serial1.println("LOW");         
        }         
     }
 }
 
 
  if (Serial1.available())
  {
    int inByte = Serial1.read();
    Serial1.write(inByte);
    
    if (flag == 0)
    {
        flag = 1;
        digitalWrite(D7, HIGH);
        Serial1.println("HIGH");
    }
    else
    {
        flag = 0;
        digitalWrite(D7, LOW);
        Serial1.println("LOW");
    }
  }
  
  if (Serial.available())
  {
    int inByte2 = Serial.read();
    Serial.write(inByte2);
    
    if (flag == 0)
    {
        flag = 1;
        digitalWrite(D7, HIGH);
        Serial.println("HIGH");
    }
    else
    {
        flag = 0;
        digitalWrite(D7, LOW);
        Serial.println("LOW");
    } 
  }
}

I need to add something :smile:

The #define DOES NOT DISPLAY CORRECTLY in THIS FORUM.

  1. This is my test code for udp and uart and blink led (D7) which is in default system mode (Auto)

  2. It is loaded to CORE by the web IDE but, not running. The led is not blinking

  3. My wifi router shows that the CORE is attached to it

Let me know if you need more info. Today is my 7th day working on the core. Thanks Kenneth !

@sam_desd, I fixed the formatting on your post. So the Core works fine with tinker running on it but not with your own UDP app, correct?

Hi Peekay,

Sorry… are you asking me or you are telling me?

@sam_desd, telling you I fixed your post and asking if tinker work but not your app. If it is your app, then we should close this topic and start another since the title is not right.

To backstep, try the simple basic program ( blink the led on pin D7). One step at a time when getting started.
Let us know if that works. Thanks for your patience.

void loop() {

//digitalWrite(D7, HIGH);
//delay(5000);
// digitalWrite(D7, LOW);
// delay(5000);

just curious, if you wanted to see the led on D7 blink, why did you comment out these lines?

Thank you peekay… It is rather a long story … I encounter problems upon another… so I make this special case where ones can take benefits as I go along to correct the various issues crops up during my journey!

Pls read from top till now.

Hi Jack,

Pls read the entire test code

Sorry Sam, I don’t have time for that if you don’t have time to answer a few questions. Good luck tho.

@sam_desd, I believe your “getting started” journey is over. Now you are into the getting it working with UDP journey and this is why I suggest changing to a new topic.

1 Like

Now I am having my CORE flashing GREEN, then RED then BLUE … again and again… that is upon reloading the firmware.

Hi Peekay, you think that I am simply maintaining this topic? I asked you to read the entire 7 days experienced that I went thru with 2 units of the CORE. Now you tell me whether my apps create this looping/reset condition OR it is something within the CORE itself?

Prior to telling me to close and move to making UDP topic… I am bringing you something to answer me. Prove me that my code creates the auto reset until I keep getting the states of LED above!

Till then only I will move to the new topic

@sam_desd, do a factory reset and reconnect the core to your network. This is the “baseline” for getting started. If that works, I propose we move to a different topic. If not, the adventure continues, ok?

Will do

1 Like

It is quite possible that the problem is not the core, but the code.
If you can run the basic “blink led on pin D7” then the core is ok. Can you run that basic code?

Hi Peekay, twice trial. The CORE now blinking blue. D7 LED not running as per in my code. Prior to factory reset I managed to get letter ‘p’ (1st letter of panic) fired to my laptop apps… now I got nothing at all. Silence like a LAMB except that blue blinking CORE!

Maybe tomorrow I will send email to Particle… see what they will advise. I am now mad professor of these 2 COREs

@sam_desd, I just need you to do a factory reset so that factory Tinker can run, NOT your code. I really need you to test the Core WITHOUT your code first. Perhaps after the factory reset and as @Jack suggested, you can run the blink LED app from the web IDE.

1 Like

Now I used back the SPARK apps in the Android to detect the CORE after the factory reset.

Then after, I used the web IDE to re flash my apps into the CORE… yes, the CORE blink magenta

Again… the CORE endlessly blinking GREEN, then RED then BLUE !

So to say, I will email Particle tomorrow.

TQ