[Electron v0.5.3]Software Timers don't seem to work...at all [Solved]

I’m playing with the FreeRTOS software timers and I can’t seem to get an LED to turn on after 10 seconds. Am I missing an #include? How did this verify/compile?

  1. Why is the Timer type not shaded blue like it is in the examples given in firmware doc?
    https://docs.particle.io/reference/firmware/electron/#software-timers
  2. Yes, I’ve tested the LED, it works on the same pin with different code.
  3. I’ve tried placing the Timer declaration above the callback definition as well - no luck.

1 Like

I could try, but I’m pretty sure they work (definetly did in 0.5.2 and do in 0.6.0-rc.2).

Maybe it’s your wiring or LED.
How about this for a test

const int led1 = D7;
void lightup() {
  digitalWrite(led1, !digitalRead(led1)); // toggle state
}
Timer timtim(1000, lightup);

void setup() {
  pinMode(led1, OUTPUT);
  timtim.start();
}

@1: Other types are not hilighted blue in Build either, so that’s no indication for a problem.
The docs hilighting is a different one to Build or Dev - but I agree that the keyword list for Build could do with some updates - on the other hand a replacement is in the works, so I guess this won’t happen and we’ll have to wait for IDE 2.0.

BTW, if you post your code as text instead of an image, it’d save us the hassle of retyping it :wink:


Update:
Tested with my Photon @ 0.5.3 and it works as expected

I think I found the problem. My code isn’t actually loading successfully over serial since I updated to v0.5.3. I can load Tinker OTA but if I load something else first and then tinker over serial it simply is not recognized as Tinker in the app - even though I’m receiving a “Flash Success!” message.

The same is true of the test apps we posted on this thread. They work when loaded OTA but not serial.

What…in tarnation?!

That is most likely because it’s an incompatible binary.
If you try flashing via

particle flash --usb firmware.bin

You’ll get better feedback about the possible reason.

You can also try

particle binary inspect firmware.bin

With that you should get something like this

C:\Temp\dmy>particle binary inspect firmware_053.bin
firmware_053.bin
 CRC is ok (bbe9b3bd)
 Compiled for electron
 This is an application module number 1 at version 4
 It depends on a system module number 2 at version 21
1 Like

This works. The code is taking. Thank you!

How do you find the time to be so resourceful, dios mio.

1 Like

Don’t ask :blush: I probably should do other things more often :wink:

2 Likes

Good to hear your code is working @markjones.cpe, thanks for the help @ScruffR!

Ok I am flashing OTA and software timers are not working for me either.

You’d need to provide some more info.
What platform are you using?
What system version?
What does not work?
Any error messages?

And please no double posting on multiple threads for the same problem.

1 Like