Having issues trying to add a library


I’m trying to add a library to the IDE, I followed the indications how to do it, but no having a success. I tried a couple libraries: Timer, and TimerOne Neither one works, I keep getting an error about “WProgram.h: No such file or directory

Searching for WProgram.h Mr Googdle basically returns nothing :frowning:

By the way, I have three Photons, one of them has the latest 0.6.1-rc.2 firmware, and I am using this one to test adding the libraries.

I am new to Photon, the Photon IDE is new to me.

Help will be appreciated.

WProgram.h is the really old predecessor of Arduino.h which is Particle.h on these devices.

But when I last tried, building against 0.6.1-rc.2 this error message should not pop up anymore.
Otherwise, just remove that include.

Have you checked if you actually set 0.6.1-rc.2 as your target in Web IDE?

1 Like

Hi ScruffR, thank your for replying. Yes, I select the correct firmware in the Web IDE, I use either the 0.6.0 or 0.6.1-rc.2. Here is the thing, if I select 0.6.0, I get that error about WProgram, if I select 0.6.1-rc.2 then I get lots of verbiage. In either case, it wont compile.

What if you try to editing the library to remove the errors?

I edited the TimerOne.h file, I commented out the #include WProgram.h entry, basically the same result.

Here is what I get if I use the 0.6.1-rc.2 firmware:

Processing /workspace/triac-timer_one.ino
fatal: destination path ‘firmware’ already exists and is not an empty directory.
From https://github.com/spark/buildpack-base

  • [new tag] 0.3.7 -> 0.3.7
    make -C …/modules/photon/user-part all
    make[1]: Entering directory '/firmware/modules/photon/user-part’
    make -C …/…/…/user
    make[2]: Entering directory '/firmware/user’
    Building cpp file: /workspace/TimerOne.cpp
    Invoking: ARM GCC CPP Compiler
    mkdir -p …/build/target/user/platform-6-m/workspace/
    arm-none-eabi-gcc -DSTM32_DEVICE -DSTM32F2XX -DPLATFORM_THREADING=1 -DPLATFORM_ID=6 -DPLATFORM_NAME=photon -DUSBD_VID_SPARK=0x2B04 -DUSBD_PID_DFU=0xD006 -DUSBD_PID_CDC=0xC006 -DSPARK_PLATFORM -g3 -gdwarf-2 -Os -mcpu=cortex-m3 -mthumb -DINCLUDE_PLATFORM=1 -DPRODUCT_ID=6 -DPRODUCT_FIRMWARE_VERSION=65535 -DUSE_STDPERIPH_DRIVER -DDFU_BUILD_ENABLE -DPARTICLE_NO_ARDUINO_COMPATIBILITY=0 -DSYSTEM_VERSION_STRING=0.6.1-rc.2 -DRELEASE_BUILD -I./inc -I…/wiring/inc -I…/system/inc -I…/services/inc -I…/communication/src -I…/hal/inc -I…/hal/shared -I…/hal/src/photon -I…/hal/src/stm32f2xx -I…/hal/src/stm32 -I…/hal/src/photon/api -I…/platform/shared/inc -I…/platform/MCU/STM32F2xx/STM32_USB_Host_Driver/inc -I…/platform/MCU/STM32F2xx/STM32_StdPeriph_Driver/inc -I…/platform/MCU/STM32F2xx/STM32_USB_OTG_Driver/inc -I…/platform/MCU/STM32F2xx/STM32_USB_Device_Driver/inc -I…/platform/MCU/STM32F2xx/SPARK_Firmware_Driver/inc -I…/platform/MCU/shared/STM32/inc -I…/platform/MCU/STM32F2xx/CMSIS/Include -I…/platform/MCU/STM32F2xx/CMSIS/Device/ST/Include -I…/dynalib/inc -I/workspace/ -I./libraries -I/workspace/ -I/workspace/ -I/workspace/ -I/workspace/ -I. -MD -MP -MF …/build/target/user/platform-6-m/workspace/TimerOne.o.d -ffunction-sections -fdata-sections -Wall -Wno-switch -Wno-error=deprecated-declarations -fmessage-length=0 -fno-strict-aliasing -DSPARK=1 -DPARTICLE=1 -DSTART_DFU_FLASHER_SERIAL_SPEED=14400 -DSTART_YMODEM_FLASHER_SERIAL_SPEED=28800 -DSPARK_PLATFORM_NET=BCM9WCDUSI09 -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc -DLOG_INCLUDE_SOURCE_INFO=1 -DPARTICLE_USER_MODULE -DUSE_THREADING=0 -DUSE_SPI=SPI -DUSE_CS=A2 -DUSE_SPI=SPI -DUSE_CS=A2 -DUSE_THREADING=0 -DUSER_FIRMWARE_IMAGE_SIZE=0x20000 -DUSER_FIRMWARE_IMAGE_LOCATION=0x80A0000 -DMODULAR_FIRMWARE=1 -DMODULE_VERSION=4 -DMODULE_FUNCTION=5 -DMODULE_INDEX=1 -DMODULE_DEPENDENCY=4,2,104 -D_WINSOCK_H -D_GNU_SOURCE -DLOG_MODULE_CATEGORY="“app”" -fno-exceptions -fno-rtti -fcheck-new -std=gnu++11 -c -o …/build/target/user/platform-6-m/workspace/TimerOne.o /workspace/TimerOne.cpp
    In file included from /workspace/TimerOne.cpp:17:0:
    /workspace/TimerOne.h:28:39: fatal error: config/known_16bit_timers.h: No such file or directory
    #include “config/known_16bit_timers.h”

compilation terminated.
…/build/module.mk:267: recipe for target ‘…/build/target/user/platform-6-m/workspace/TimerOne.o’ failed
make[2]: *** […/build/target/user/platform-6-m/workspace/TimerOne.o] Error 1
make[2]: Leaving directory ‘/firmware/user’
…/…/…/build/recurse.mk:11: recipe for target ‘user’ failed
make[1]: Leaving directory '/firmware/modules/photon/user-part’
make[1]: *** [user] Error 2
…/build/recurse.mk:11: recipe for target ‘modules/photon/user-part’ failed
make: *** [modules/photon/user-part] Error 2Error: Could not compile. Please review your code.

There’s your problem. That header file cannot be found.

I added that file, still having errors. This is crazy, I wish I can program the Photon using the Arduino IDE. I like the Photon, but I guess Is a PITA.

Have you tried Particle Dev?

Also, you can already do Timers on the Photon, so I don’t really see the need for this library.

1 Like

I am using right now the Particle Web Dev, not the desktop.

Yes, i know the Photon can do Timers. I am trying to develop a dimmer using the zero cross point of the AC line, I found a couple examples that I like to try out, but they are using those libraries, that is the only reason.

Why not adapt those examples?

1 Like

@italex, the TimerOne library is very hardware specific and NOT compatible with the photon.

Too much hassle. Why re-invent the wheel? Much easier to switch back to the Arduino Farm and forget all about the Photon.

peekay123: if the TimeOne library is Photon compatible, why am I having so much issues?

I guess @peekay123 has just missed out a “not” in his post.

Since that lib is HW specific it’s not compatible.

BTW there are other zero-cross/dimmer threads on this forum and they use the SparkIntervalTimer library to do the timing.

That basically comes down to the question why there is not only AVR producing micro controllers. STM should just pack it in and leave the world unaffected by innovation?

STM should just pack and leave…? I found this offensive! You guys are NOT FRIENDLY FOLKS!

I think you misunderstood my point - and I forgot to end that sentence with the more appropriate question mark (which I added now).
That was meant as an ironic statement, to stress the point that “reinventing the wheel” is inevitable when different hardware demands for different techniques.
After all the Particle devices are running on STM controllers, the original Arduinos are running on AVR.
So why would I “tell” STM to pack it in? They make the controllers I consider superior to the AVRs (at least the ones used on vanilla Arduinos).


Jumping to conclusions and generalizing based upon an “unreflected” notion what was meant (but wasn’t really) doesn’t seem too friendly either.
Especially since using all capitals is considered shouting on community boards.