Hi all,
I wondered if someone could have a look at porting the adafruit 16 channel servo / LED driver library,
?
Many thanks,
Julian
Hi all,
I wondered if someone could have a look at porting the adafruit 16 channel servo / LED driver library,
?
Many thanks,
Julian
@Julian, I will work on it. Do you want it on the IDE or for local compiling with spark cli?
IDE please.
Thank you very much.
@Julian, the library is now on the IDE as “Adafruit_PWMServoDriver”. The only issue at this time is that the I2C bus speed is NOT set to 400KHz as the code for this is not in production yet.
Wow that was quick. Thank you very much.
Regarding the frequency, are you refering to the spark core I2C bus not being set to 400Hz? Does that mean that I should set the frequency with the following code to less than 400?
pwm.setPWMFreq(350)
Would that work?
Many thanks again,
@Julian, no modifications are required I believe.
When the term port is used, what all is involved with actually doing the port? I only ask about this instance in particular because it seems so non chalantly carried out in a quick fashion. I’ve seen frustration over the lack of particular software ports on nearly every platform.
Well, @peekay123 is a boss!
The Spark core firmware was designed to be very similar to Arduino and so porting Arduino code can be very easy if the particular library does not use any specific hardware features of the Atmel processors. If the library uses low-level hardware features then it can be hard to port and take more time.
@Buds444, Other people more qualified than me would be able to answer that question. From my perspective I can say that the spark community is filled with strong, responsive, helpfull and patient experts from many different backgrounds. In short the strength of the spark core “platform” is not totally contained in the hardware or the cloud software but is better illustrated by the community spirit and support for users of all levels.
Lots of stuff is already ported and additions are made on a frequent basis.
@Julian
Being new to this arena, I would have to agree that what I’m seeing and a vast majority of my fascination with the spark core, is the community surrounding it. Smartthings has a similar feel if any of you guys have delved into that world.
I was just curious to know what type of effort goes into to porting a library from one device to another. I think @bko answered my question very well. I’ll have to one day compare the a library for arduino to it’s port on spark and see what the difference is visually.
@Julian, @Buds444, the library I posted maintained the Arduino compatibility using a trick called conditional compiling. You will see “#if defined (SPARK)” statements where Spark code needs to be substituted or Arduino code not included. Well written libraries “abstract” the hardware-specific code from the general code making it simpler to port. However, sometimes hardware-specific Arduino code needs to be addressed with a Spark-specific substitute. I wrote the SparkIntervalTimer library for this reason. I enjoy the challenge of porting libraries though for many, it is simply a matter of conditionally compiling out the Arduino include statements and adding the Spark ones.
You are correct in saying that one of Spark’s biggest value is in its community. @bko flatters me but the truth is that for the web side of things I feel like I know nothing next to him! The vast knowledge of this community and their willingness to share it is truly exceptional and (mostly) uncommon.
@peekay123 in the arduino code they use A4 and A5 for SDA and SCL. should this be D0 and D1 on the spark core?
Many thanks
@Julian, that is correct. Make sure the board has pull-up resistors and if not, you will need to add them.
Thanks peekay, I found this
https://forums.adafruit.com/viewtopic.php?f=19&t=42669
and so I think the pull up resistors are built into the board.