Hi all, new to Electron and Particle. I’m just trying to get a ‘hello world’ app running and can’t seem to get it working. I’m uploading the code below via USB, which appears to be working. When I use the CLI to open a serial monitor, I can see it working before it connects to the cloud. Then once the on-board status LED starts breathing cyan, the serial port doesn’t read anything.
Also, the LED I’ve specified is not responding and I’ve triple checked the wiring. Am I missing something basic about setting up pins and/or Serial?
int button = D1;
int led = D2;
int prevState = 0;
void setup() {
pinMode(led, OUTPUT);
pinMode(button, INPUT);
Serial.begin(9600);
Serial.println("hello");
digitalWrite(led, LOW);
}
void loop() {
int currState = digitalRead(button);
Serial.println(currState);
if (currState == 0 && prevState == 1) {
digitalWrite(led, HIGH);
delay(500);
digitalWrite(led, LOW);
}
prevState = currState;
}
Thanks for the explanation, @ScruffR. That is my product number. Still not sure how this helped things, or perhaps along the way I changed some small thing that made a difference. Frustrating not knowing what it was exactly, but with things working now I"m just going to move on…
Since you made the device a product already it’s possible (intended) that only “legitimate” code sticks to prevent someone else from using your product and flash their own non-product code to it.
But to be certain other possible reasons would need to be tested and more details be known how things were done in the past (when setting the product ID) and how exactly you built and flashed and other things.