Yes, that could be a problem.
Dave
buzzing mindfulness bracelet code plus some new functions
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- dastels
- Posts: 15662
- Joined: Tue Oct 20, 2015 3:22 pm
- bozzaglia
- Posts: 131
- Joined: Mon Aug 01, 2022 6:14 am
Re: buzzing mindfulness bracelet code plus some new functions
I think I found a way to code the pin.alarm, but wanted to use board.SWITCH (the feather extra onboard tactile button) as my pin.
However that same SWITCH is also used to trigger a write action, but only in very short time windows.
I am getting a “pin already in use” error when I load the code.
Is it because it cannot be used for two purposes like this?
If so, is there any workaround?
Thanks!
However that same SWITCH is also used to trigger a write action, but only in very short time windows.
I am getting a “pin already in use” error when I load the code.
Is it because it cannot be used for two purposes like this?
If so, is there any workaround?
Thanks!
- dastels
- Posts: 15662
- Joined: Tue Oct 20, 2015 3:22 pm
Re: buzzing mindfulness bracelet code plus some new functions
You can't create more than one DigitalInOut for a single pin. Can't you reuse the DigitalInOut?
Dave
Dave
- bozzaglia
- Posts: 131
- Joined: Mon Aug 01, 2022 6:14 am
Re: buzzing mindfulness bracelet code plus some new functions
If I understood correctly, you are suggesting that instead of using "board.SWITCH" as argument of the pin_alarm function (forgive my argument/function terminology, which might be improper), I use the keyword that I have already associated with board.SWITCH as DigitalInOut.
So that would be "pulsante":
And in that case I should write the pin_alarm as follows:
I tried to do this and got an error message "pin expected" referring to the pin_alarm line.
Did I misunderstand something?
So that would be "pulsante":
Code: Select all
pulsante = DigitalInOut(board.SWITCH)
pulsante.direction = Direction.INPUT
pulsante.pull = Pull.UP
Code: Select all
pin_alarm = alarm.pin.PinAlarm(pin=pulsante, value=False, pull=True)
Did I misunderstand something?
- dastels
- Posts: 15662
- Joined: Tue Oct 20, 2015 3:22 pm
Re: buzzing mindfulness bracelet code plus some new functions
Yeah, that expects a Pin object, i.e. board.SWITCH in this case.
So you'll have to get rid of the other use. I'm not sure how just yet.
Dave
So you'll have to get rid of the other use. I'm not sure how just yet.
Dave
- dastels
- Posts: 15662
- Joined: Tue Oct 20, 2015 3:22 pm
Re: buzzing mindfulness bracelet code plus some new functions
Got it. Use
That will free the Pin object (i.e. board.SWITCH) so you can then pass it to alarm.pin.PinAlarm.
Dave
Code: Select all
pulsante.deinit()
Dave
- bozzaglia
- Posts: 131
- Joined: Mon Aug 01, 2022 6:14 am
Re: buzzing mindfulness bracelet code plus some new functions
Should I just put
right before
?
If so, would it retain the other use I am making of pulsante in the rest of the code?
Code: Select all
pulsante.deinit()
Code: Select all
pin_alarm = alarm.pin.PinAlarm(pin=pulsante, value=False, pull=True)
If so, would it retain the other use I am making of pulsante in the rest of the code?
- dastels
- Posts: 15662
- Joined: Tue Oct 20, 2015 3:22 pm
Re: buzzing mindfulness bracelet code plus some new functions
You would need to do
If you wanted to use board.SWITCH again for pulsante ... I don't see something like deinit for PinAlarm. You might not be able to use the same pin for each. That wouldn't be overly surprising.
Dave
Code: Select all
pin_alarm = alarm.pin.PinAlarm(pin=board.SWITCH, value=False, pull=True)
Dave
- bozzaglia
- Posts: 131
- Joined: Mon Aug 01, 2022 6:14 am
Re: buzzing mindfulness bracelet code plus some new functions
Update: I avoided the problem by removing completely the light sleep from the code, so I don’t need to use the pin.alarm.
I still get about 36 hours of battery life on my 350mah cell.
I’m pretty happy with how it works now!
I have been wondering for a while about trying to streamline the project to produce higher numbers and try to market it. Of course is more of a fantasy right now but should I manage to do it, could I still exploit the glider app for free or would I have to pay some rights to Adafruit?
I still get about 36 hours of battery life on my 350mah cell.
I’m pretty happy with how it works now!
I have been wondering for a while about trying to streamline the project to produce higher numbers and try to market it. Of course is more of a fantasy right now but should I manage to do it, could I still exploit the glider app for free or would I have to pay some rights to Adafruit?
- dastels
- Posts: 15662
- Joined: Tue Oct 20, 2015 3:22 pm
Re: buzzing mindfulness bracelet code plus some new functions
"glider app"?
Dave
Dave
- bozzaglia
- Posts: 131
- Joined: Mon Aug 01, 2022 6:14 am
- dastels
- Posts: 15662
- Joined: Tue Oct 20, 2015 3:22 pm
Re: buzzing mindfulness bracelet code plus some new functions
It's in a public github repo https://github.com/adafruit/Glider-for-iOS. I don't see any licensing information but it is public and there are a couple forks so I'd say it's fair game.
That said, I'll ask to be sure.
Dave
That said, I'll ask to be sure.
Dave
- dastels
- Posts: 15662
- Joined: Tue Oct 20, 2015 3:22 pm
Re: buzzing mindfulness bracelet code plus some new functions
The MIT license will be added to the project:
DaveCopyright <YEAR> <COPYRIGHT HOLDER>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, BANNED FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- bozzaglia
- Posts: 131
- Joined: Mon Aug 01, 2022 6:14 am
Re: buzzing mindfulness bracelet code plus some new functions
Cool! I understand it means the app can be used without any restriction provided the license is included.
You guys really do a great work!
Thanks Dave
You guys really do a great work!
Thanks Dave
- dastels
- Posts: 15662
- Joined: Tue Oct 20, 2015 3:22 pm
Re: buzzing mindfulness bracelet code plus some new functions
Used, redistributed, modified, etc. The MIT license is pretty open. Just inlude the license with the original copyright notice.
Dave
Dave
Please be positive and constructive with your questions and comments.