Arduino Lightsaber for/with LED string blade

neskweek:
For your use case you might want to make a new fonction though. fadeAccent was designed to make an accent LED blink when the saber is idle.
In action mode the loop is slower, but it should be fast enough to trigger a nice fading pattern.
As for synchronzing it with the main blade, I didn't look at that but it might be possible: with this code it is impossible to make it flicker as fast as the main blade, but you should be able to trigger a flicker effect suffisant to trick your eye.

I tried playing around with this and the action loop is definitely slower. Trying to play around with function placement to increase speed. Can you clarify what ISR(TIMER2_COMPA_vect, ISR_NOBLOCK) is used for?

Hello

ISR is used to produce a timed low priority callback every 24ms .

It is used to apply light/color effects on the blade (blaster blocks, clash, lockups,flicker)

@Everyone
You can safely use Arduino eclipse V3. I also switched to this version.

neskweek:
Hello

ISR is used to produce a timed low priority callback every 24ms .

It is used to apply light/color effects on the blade (blaster blocks, clash, lockups,flicker)

@Everyone
You can safely use Arduino eclipse V3. I also switched to this version.

I hope thats good news as I can't seem but to switch from one frustration to another. My time is limited that I can devote and evrytime I turn around something new crops up. So last night I hook the bread board up to the laptop compile and upload the sketch. I realize i never ran the calibration. So i try to setup the imu calibration tool and it wont compile.... I play around for a bit and cant get it. So i delete the project only to find the lightsaber sketch wont compile..... Today i had to install gcc seperately and that got me further but its now having an issue with make... This is pretty much out of the blue. So I hope v3 is some better as id almost rather use notepad and run command line which...eh im not excited about.

Btw can anyone tell me if the raw pin on a pro mini is the same ss the 3.3 on the nano? I tried posting this earlier but i think the thread ate it. Im starting to wish i went with the nano instead i dont like the usb break out board with pro mini. Live and learn.

Edit: hmmm unless the on the nano is from 3.3 v pin is the just the one from the ftdi chip which i think is the case. N/M ill just need to rereview the pin outs for the los on the nano next to the pro mini pin outs and reverify evrerything as they are slightly different.

RAW pin on promini is the input to the onboard regulator.

3.3V pin on nano is the 3.3V output from the FTDI chip.
(on CH430 clones, who knows).

As of right now I hate eclipse. One day it worked only one day. I've tried two different PCs. The Paths issues it has are odd and then the make issue. Once I regain sanity I will try again to wipe it all out and start again. V3 will not even run due to some bash error.... I'm sure Windows 10 is partly to blame somewhere. I seem to be the only one with these issues.

Hallelujah, I believe I have found success with eclipse Mars and installing the plugin... Seems much better.

Soulbp:
Hallelujah, I believe I have found success with eclipse Mars and installing the plugin... Seems much better.

If I get ambitious, I may tweak LightsaberOS so it builds in the Arduino IDE. Once Nesweek ports it to use the Universal Saber Library that I developed as he's suggested doing in the future, that may become much easier. That lib already builds with the Arduino IDE.

Yes, I thought about that but truth is eclipse is nice... There are just issues. Arduino Mars with MinGW and eclipse plugin v3 and arduino 1.65 was the trick. I think I'm going to switch to a nano though as now I have this worked out I don't k ow if I feel like converting the wiring diagram to work with the pro mini... I'm not sure. I was hoping to be much further along now.

Soulbp:
Yes, I thought about that but truth is eclipse is nice... There are just issues. Arduino Mars with MinGW and eclipse plugin v3 and arduino 1.65 was the trick. I think I'm going to switch to a nano though as now I have this worked out I don't k ow if I feel like converting the wiring diagram to work with the pro mini... I'm not sure. I was hoping to be much further along now.

Oh, no doubt. I like Eclipse and I use it myself. For those just looking to build LightsaberOS and dump to an MCU though, it is not as straight forward to install and configure as the Arduino IDE. So, there's just that on the accessibility/approachability angle.

JakeSoft:
Oh, no doubt. I like Eclipse and I use it myself. For those just looking to build LightsaberOS and dump to an MCU though, it is not as straight forward to install and configure as the Arduino IDE. So, there's just that on the accessibility/approachability angle.

I can secound that. As I'm not a SW pro, I was happy to be able to install the Arduino IDE as is. With Eclipse I did not have that luck so far, which means all those nice updates from neskweek I cannot try with my shiny new DIYino boards !!! (weeep) Anyway, I do not give up, but if the code could compile with Arduino IDE, it would be a real achievement.

Protonerd:
I can secound that. As I'm not a SW pro, I was happy to be able to install the Arduino IDE as is. With Eclipse I did not have that luck so far, which means all those nice updates from neskweek I cannot try with my shiny new DIYino boards !!! (weeep) Anyway, I do not give up, but if the code could compile with Arduino IDE, it would be a real achievement.

What issues are you having with eclipse? I'm no expert but I have learned something's now as it's been a nightmare. Once I figured some things out such as the bundle gives you less control than the plugin.

JakeSoft:
If I get ambitious, I may tweak LightsaberOS so it builds in the Arduino IDE. Once Nesweek ports it to use the Universal Saber Library that I developed as he's suggested doing in the future, that may become much easier. That lib already builds with the Arduino IDE.

That is still planned. The hardware building is just more difficult, pityless and time consuming that I first planned :stuck_out_tongue:

Not sure anyway that once LSOS will be ported to USaber Lib that it come back compatible with Arduino IDE.

But tweaks are welcome off course :wink:

neskweek:
Not sure anyway that once LSOS will be ported to USaber Lib that it come back compatible with Arduino IDE.

True, there is no guarantee, but potentially huge blocks of your code could be managed by USaber library classes (blade control, sound playback, motion detection) which themselves do/will build in the standard IDE. You'll have a much narrower scope of code to adjust for Arduiono IDE compatibility.

UPDATE the changes in my repository have been merged into the main LightSaberOS and it is now compatible with the Arduino IDE.

JakeSoft:
If I get ambitious, I may tweak LightsaberOS so it builds in the Arduino IDE.

I did this a little while ago because I was trying to help @772pilot use my soft PWM library with LightSaberOS and I don't have Eclipse installed. To make it compile with Arduino IDE 1.6.6 and later you only need to change the filename of Lightsaber.ino to match the folder name and move(not copy!) the libraries to the libraries folder in your sketchbook folder. I just posted it on GitHub in case it might be of interest to anyone. The changes I made are shown at: ~~https://github.com/per1234/LightSaberOS/commit/0a13827be9096ade53728921bb7489aebea63f7f~~
So to use it:

I changed the library include paths so that you don't need to do any extra steps to install the libraries but that's not necessary, it just makes installation easier and avoids any conflicts with previously installed libraries. I think if you're going to make an Arduino project available to the public it's only common sense to make it compatible with the Arduino IDE. I agree that this will make LightSaberOS more accessible. I don't own a light saber so I can't test this on the hardware but it does compile with Arduino IDE 1.6.6, 1.6.7, 1.6.8, and the hourly build. I haven't tested if this breaks Eclipse compatibility but I don't see any reason why it would. The Eclipse installation process would be different(more simple) since the libraries don't need to be installed.

I'm happy to add Arduino IDE install instructions to the readme and submit a pull request for this change to the LightSaberOS repository if neskweek wants me to.

pert:
I did this a little while ago because I was trying to help @772pilot use my soft PWM library with LightSaberOS and I don't have Eclipse installed. To make it compile with Arduino IDE 1.6.6 and later you only need to change the filename of Lightsaber.ino to match the folder name and move(not copy!) the libraries to the libraries folder in your sketchbook folder. I just posted it on GitHub in case it might be of interest to anyone. The changes I made are shown at: https://github.com/per1234/LightSaberOS/commit/0a13827be9096ade53728921bb7489aebea63f7f
So to use it:

I changed the library include paths so that you don't need to do any extra steps to install the libraries but that's not necessary, it just makes installation easier and avoids any conflicts with previously installed libraries. I think if you're going to make an Arduino project available to the public it's only common sense to make it compatible with the Arduino IDE. I agree that this will make LightSaberOS more accessible. I don't own a light saber so I can't test this on the hardware but it does compile with Arduino IDE 1.6.6, 1.6.7, 1.6.8, and the hourly build. I haven't tested if this breaks Eclipse compatibility but I don't see any reason why it would. The Eclipse installation process would be different(more simple) since the libraries don't need to be installed.

I'm happy to add Arduino IDE install instructions to the readme and submit a pull request for this change to the LightSaberOS repository if neskweek wants me to.

Well, would you look at that? Ask and you shall receive! I continue to be impressed by the helpfulness and capabilities of the community members here on the Arduino forums. Thank you!

pert:
I did this a little while ago because I was trying to help @772pilot use my soft PWM library with LightSaberOS and I don't have Eclipse installed. To make it compile with Arduino IDE 1.6.6 and later you only need to change the filename of Lightsaber.ino to match the folder name and move(not copy!) the libraries to the libraries folder in your sketchbook folder. I just posted it on GitHub in case it might be of interest to anyone. The changes I made are shown at: https://github.com/per1234/LightSaberOS/commit/0a13827be9096ade53728921bb7489aebea63f7f

Impressive, I will give it a go as soon as I get near my workbench!!! Thanks a lot, that is a great contribution, I never stop to be amazed by this community.

Wonderfull job Pert !

I'll test your changes as soon as I can to make them go mainstream.

Changes to readme are welcome too :wink:

Thank you very much

UPDATE the changes in my repository have been merged into the main LightSaberOS and it is now compatible with the Arduino IDE.

It was bothering me that LightSaberOS still wouldn't compile in Arduino IDE versions previous to 1.6.6. Many users have not wanted to upgrade past 1.6.5-r5 due to some bugs and breakage caused by changes made in 1.6.6. So I made the changes required to make LightSaberOS compatible with the older versions, shown at ~~https://github.com/neskweek/LightSaberOS/compare/master...per1234:all-Arduino-IDE-compatibility~~. Unfortunately Arduino IDE versions previous to 1.6.6 don't support using libraries in subfolders of the sketch folder so to use this version of LightSaberOS with the Arduino IDE:

  • Download ~~https://github.com/per1234/LightSaberOS/archive/all-Arduino-IDE-compatibility.zip~~
  • Unzip
  • Rename the folder LightSaberOS-all-Arduino-IDE-compatibility to LightSaberOS
  • Move(copy will cause compile to fail with IDE versions >=1.6.7) all subfolders of LightSaberOS/Libraries to {sketchbook folder}/libraries. To find your sketchbook folder location check File > Properties > Sketchbook location
  • Open the file LightSaberOS.ino in the Arduino IDE

I was able to compile with all Arduino IDE versions from 1.6.0-1.6.8 and the hourly build except for 1.6.4 which hung on compilation. This is a known issue with 1.6.4(not a LightSaberOS specific problem) and your results may vary. I didn't test Arduino IDE 1.5.x. LightSaberOS still doesn't compile with Arduino IDE 1.0.6, this could probably be fixed but I don't know how many people are still using the 1.0.x versions. As before, I haven't tested on hardware or with Eclipse.

I think it's unfortunate to lose the ability to use the libraries in place with Arduino IDE 1.6.6 and later as I had it set up in the version of LightSaberOS I posted previously. This could be worked around, for example:

#if ARDUINO > 10605
#include "Libraries/DFPlayer.h"
#else
#include <DFPlayer.h>
#endif

The downsides to this is that it will require different installation instructions depending on the IDE version.

I'm open to any feedback on these changes and am happy to submit a pull request.

Any one wire this up with a pro mini? Looking at the nano wiring diagram it seems odd because when I look at an online nano pin out the seem off. I thought I had it converted over but I guess no as my IMU doesn't initialize nor dfplayer